We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What would you like to be added: Use Etcd to implement Distributed Lock API
Why is this needed: see #104
The text was updated successfully, but these errors were encountered:
想了一下设计的几个点,目前的 api 比较简单 TryLock UnLock 还有个 expire 机制, 以下的 k 表示 ResourceId,v 表示 LockOwner expire: 使用租约机制(不续约,如果租约到期表示超时释放锁) TryLock: 首先创建租约,然后使用 etcd clientv3 txn,compare key revision=0, then put k/v and lease, else get key. txn commit 成功则表示抢到锁 UnLock: 同样使用 txn, compare v=req.LockOwner, then del key ,else get key, txn commit 成功表示删除锁成功,如果失败可以根据 txn responsee 来得到是什么原因 LOCK_UNEXIST or LOCK_BELONG_TO_OTHERS
Sorry, something went wrong.
感谢您对Layotto的支持,已assign! etcd支持服务端到时间自动删除节点,这点比zookeeper方便多了(zookeeper的ttl node特性默认是关闭的,我和@ZLBer 同学纠结了好长时间) :(
stulzq
Successfully merging a pull request may close this issue.
What would you like to be added:
Use Etcd to implement Distributed Lock API
Why is this needed:
see #104
The text was updated successfully, but these errors were encountered: