Function etcd::kv::compare_and_swap

source ·
pub fn compare_and_swap<C>(
    client: &Client<C>,
    key: &str,
    value: &str,
    ttl: Option<u64>,
    current_value: Option<&str>,
    current_modified_index: Option<u64>
) -> impl Future<Item = Response<KeyValueInfo>, Error = Vec<Error>> + Sendwhere
    C: Clone + Connect,
Expand description

Updates a node only if the given current value and/or current modified index match.

Parameters

  • client: A Client to use to make the API call.
  • key: The name of the node to update.
  • value: The new value for the node.
  • ttl: If given, the node will expire after this many seconds.
  • current_value: If given, the node must currently have this value for the operation to succeed.
  • current_modified_index: If given, the node must currently be at this modified index for the operation to succeed.

Errors

Fails if the conditions didn’t match or if no conditions were given.