class Etcdv3::KV::Transaction
Constants
- COMPARISON_IDENTIFIERS
Available comparison identifiers.
- TARGETS
Available targets to compare with.
Attributes
compare[W]
failure[W]
success[W]
Public Class Methods
new()
click to toggle source
# File lib/etcdv3/kv/transaction.rb, line 23 def initialize; end
Public Instance Methods
compare()
click to toggle source
# File lib/etcdv3/kv/transaction.rb, line 25 def compare @compare ||= [] end
create_revision(key, compare_type, value)
click to toggle source
txn.create_revision('names', :less, 10)
# File lib/etcdv3/kv/transaction.rb, line 72 def create_revision(key, compare_type, value) generate_compare(:create_revision, key, compare_type, value) end
del(key, range_end='')
click to toggle source
txn.del('key')
# File lib/etcdv3/kv/transaction.rb, line 50 def del(key, range_end='') del_request(key, range_end) end
failure()
click to toggle source
# File lib/etcdv3/kv/transaction.rb, line 33 def failure @failure ||=[] end
get(key, opts={})
click to toggle source
txn.get('key')
# File lib/etcdv3/kv/transaction.rb, line 45 def get(key, opts={}) get_request(key, opts) end
mod_revision(key, compare_type, value)
click to toggle source
txn.mod_revision('names', :not_equal, 0)
# File lib/etcdv3/kv/transaction.rb, line 67 def mod_revision(key, compare_type, value) generate_compare(:mod_revision, key, compare_type, value) end
put(key, value, lease=nil)
click to toggle source
txn.put('my', 'key', lease_id: 1)
# File lib/etcdv3/kv/transaction.rb, line 40 def put(key, value, lease=nil) put_request(key, value, lease) end
success()
click to toggle source
# File lib/etcdv3/kv/transaction.rb, line 29 def success @success ||= [] end
value(key, compare_type, value)
click to toggle source
txn.value('names', :equal, 'wowza' )
# File lib/etcdv3/kv/transaction.rb, line 62 def value(key, compare_type, value) generate_compare(:value, key, compare_type, value) end
version(key, compare_type, value)
click to toggle source
txn.version('names', :greater, 0 )
# File lib/etcdv3/kv/transaction.rb, line 57 def version(key, compare_type, value) generate_compare(:version, key, compare_type, value) end
Private Instance Methods
generate_compare(target_union, key, compare_type, value)
click to toggle source
# File lib/etcdv3/kv/transaction.rb, line 78 def generate_compare(target_union, key, compare_type, value) Etcdserverpb::Compare.new( key: key, result: COMPARISON_IDENTIFIERS[compare_type], target: TARGETS[target_union], target_union => value ) end