pub struct KVCreateOrUpdateKeyQuery {
pub dc: Option<String>,
pub flags: Option<u64>,
pub cas: Option<u64>,
pub acquire: Option<String>,
pub release: Option<String>,
}
Fields§
§dc: Option<String>
Specifies the datacenter to query. This will default to the datacenter of the agent being queried.
flags: Option<u64>
Specifies an unsigned value between 0 and (2^64)-1 to store with the key. API consumers can use this field any way they choose for their application.
cas: Option<u64>
Specifies to use a Check-And-Set operation. This is very useful as a building block for more complex synchronization primitives. If the index is 0, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
acquire: Option<String>
Supply a session ID to use in a lock acquisition 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 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. 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. Note that an update that does not include the acquire parameter will proceed normally even if another session has locked the key.
release: Option<String>
Supply a session ID to use in a release operation. This is useful when paired with ?acquire= as it allows clients to yield a lock. This will leave the LockIndex unmodified but will clear the associated Session of the key. The key must be held by this session to be unlocked.