Skip to content

Commit

Permalink
improvement(kv): pass lease to compare_and_swap
Browse files Browse the repository at this point in the history
  • Loading branch information
caspiano committed Jan 23, 2020
1 parent b95bc06 commit 985c768
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: etcd
version: 0.2.2
version: 0.2.3

authors:
- Caspian Baska <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion src/etcd/kv.cr
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module Etcd
# Sets a `key` if the given `previous_value` matches the existing value for `key`
#
# Wrapper over the etcd transaction API.
def compare_and_swap(key, value, previous_value) : Bool
def compare_and_swap(key, value, previous_value, lease_id : Int64 = 0_i64) : Bool
encoded_key = Base64.strict_encode(key)
encoded_value = Base64.strict_encode(value.to_s)
encoded_previous_value = Base64.strict_encode(previous_value.to_s)
Expand All @@ -143,6 +143,7 @@ module Etcd
:request_put => {
:key => encoded_key,
:value => encoded_value,
:lease => lease_id,
},
}],
}
Expand Down

0 comments on commit 985c768

Please sign in to comment.