Updates docs about new "acquire when you already have it" behavior.

pull/1291/head
James Phillips 2015-10-09 09:04:52 -07:00
parent 91ff5254dd
commit dc05fb728a
1 changed files with 7 additions and 3 deletions

View File

@ -61,8 +61,9 @@ if "?recurse" is provided, the returned `X-Consul-Index` corresponds
to the latest `ModifyIndex` within the prefix, and a blocking query using that to the latest `ModifyIndex` within the prefix, and a blocking query using that
"?index" will wait until any key within that prefix is updated. "?index" will wait until any key within that prefix is updated.
`LockIndex` is the last index of a successful lock acquisition. If the lock is `LockIndex` is the number of times this key has successfully been acquired in
held, the `Session` key provides the session that owns the lock. a lock. If the lock is held, the `Session` key provides the session that owns
the lock.
`Key` is simply the full path of the entry. `Key` is simply the full path of the entry.
@ -114,7 +115,10 @@ be used with a PUT request:
operation. This is useful as it allows leader election to be built on top operation. This is useful as it allows leader election to be built on top
of Consul. If the lock is not held and the session is valid, this increments of Consul. If the lock is not held and the session is valid, this increments
the `LockIndex` and sets the `Session` value of the key in addition to updating the `LockIndex` and sets the `Session` value of the key in addition to updating
the key contents. A key does not need to exist to be acquired. the key contents. A key does not need to exist to be acquired. If the lock is
already held by the given session, then the `LockIndex` is not incremented but
the key contents are updated. This lets the current lock holder update the key
contents without having to give up the lock and reacquire it.
* ?release=\<session\> : This flag is used to turn the `PUT` into a lock release * ?release=\<session\> : This flag is used to turn the `PUT` into a lock release
operation. This is useful when paired with "?acquire=" as it allows clients to operation. This is useful when paired with "?acquire=" as it allows clients to