Compare commits

..

4 Commits

Author SHA1 Message Date
5271378fc2 Merge pull request #416 from drnic/patch-1
[readme] references to BOSH releases using etcd
2013-12-23 11:14:28 -08:00
5ab2f5454c [readme] references to BOSH releases using etcd 2013-12-23 09:49:24 -08:00
4748da1e09 Merge pull request #415 from philips/fix-lock-docs
fix(README): fixup lock docs
2013-12-23 05:53:23 -08:00
c3b4d10b74 fix(README): fixup lock docs
I thought that @benbjohnson had changed the lock "value" to "name" but
that doesn't look to be the case. It is OK, just fix the docs.
2013-12-22 22:03:07 -08:00

View File

@ -971,22 +971,22 @@ An HTML dashboard can be found at `http://127.0.0.1:4001/mod/dashboard/```
### Lock
The Lock module implements a fair lock that can be used when lots of clients want access to a single resource.
A lock can be associated with a name.
The name is unique so if a lock tries to request a name that is already queued for a lock then it will find it and watch until that name obtains the lock.
If you lock the same name on a key from two separate curl sessions they'll both return at the same time.
A lock can be associated with a value.
The value is unique so if a lock tries to request a value that is already queued for a lock then it will find it and watch until that value obtains the lock.
If you lock the same value on a key from two separate curl sessions they'll both return at the same time.
Here's the API:
**Acquire a lock (with no name) for "customer1"**
**Acquire a lock (with no value) for "customer1"**
```sh
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60
```
**Acquire a lock for "customer1" that is associated with the name "bar"**
**Acquire a lock for "customer1" that is associated with the value "bar"**
```sh
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d value=bar
```
**Renew the TTL on the "customer1" lock for index 2**
@ -995,13 +995,13 @@ curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d index=2
```
**Renew the TTL on the "customer1" lock for name "customer1"**
**Renew the TTL on the "customer1" lock for value "customer1"**
```sh
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d value=bar
```
**Retrieve the current name for the "customer1" lock.**
**Retrieve the current value for the "customer1" lock.**
```sh
curl http://127.0.0.1:4001/mod/v2/lock/customer1
@ -1019,10 +1019,10 @@ curl http://127.0.0.1:4001/mod/v2/lock/customer1?field=index
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?index=customer1
```
**Delete the "customer1" lock with the name "bar"**
**Delete the "customer1" lock with the value "bar"**
```sh
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?name=bar
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?value=bar
```
@ -1118,6 +1118,11 @@ See [CONTRIBUTING](https://github.com/coreos/etcd/blob/master/CONTRIBUTING.md) f
- [spheromak/etcd-cookbook](https://github.com/spheromak/etcd-cookbook)
**BOSH Releases**
- [cloudfoundry-community/etcd-boshrelease](https://github.com/cloudfoundry-community/etcd-boshrelease)
- [cloudfoundry/cf-release](https://github.com/cloudfoundry/cf-release/tree/master/jobs/etcd)
**Projects using etcd**
- [binocarlos/yoda](https://github.com/binocarlos/yoda) - etcd + ZeroMQ