-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release and delete a lock as one operation #840
Comments
Tagged as enhancement, makes sense to me! |
This is now supported in Consul 0.7 - https://www.consul.io/docs/agent/http/kv.html#txn. |
@slackpad May I ask how txn solves this? You can only do PUTs in a txn, so how do I combine a PUT (to unlock) and DELETE? |
@fraenkel with the /v1/txn endpoint you PUT a JSON structure with a list of operations to perform - you would PUT a structure like this:
These are done atomically, so if the unlock succeeds it will delete the key as part of the same request. |
@slackpad The docs say PUT is only supported which is why I asked. Ah, so that meant you PUT /v1/txn but any verb is supported. |
That's correct - you always PUT to /v1/txn with a list of updates and their associated verbs. |
The current behavior follows what I consider the default behavior for a session to release a lock. With the addition of being able to specify delete, wouldn't it also be useful to allow the Release() API to optionally delete as well? We have cases where we would prefer to avoid the Release/Destroy 2 step and just be able to combine them as one.
I could easily imagine that the DELETE of an acquired KV could also allow the flag & release parameters.
The text was updated successfully, but these errors were encountered: