Module: Etcdv3::Namespace::KV::Requests
- Included in:
- Etcdv3::Namespace::KV, Transaction
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/namespace/kv/requests.rb
Constant Summary collapse
- SORT_TARGET =
{ key: 0, version: 1, create: 2, mod: 3, value: 4 }
- SORT_ORDER =
{ none: 0, ascend: 1, descend: 2 }
Instance Method Summary collapse
- #del_request(key, range_end = nil) ⇒ Object
- #get_request(key, opts) ⇒ Object
- #put_request(key, value, lease = nil) ⇒ Object
Instance Method Details
#del_request(key, range_end = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/namespace/kv/requests.rb', line 35 def del_request(key, range_end=nil) key = prepend_prefix(@namespace, key) # In order to enforce the scope of the specified namespace, we are going to # intercept the zero-byte reference and re-target everything under the given namespace. if range_end =~ /\x00/ range_end = (@namespace[0..-2] + (@namespace[-1].ord + 1).chr) else range_end = prepend_prefix(@namespace, range_end) if range_end end Etcdserverpb::DeleteRangeRequest.new(key: key, range_end: range_end) end |
#get_request(key, opts) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/namespace/kv/requests.rb', line 18 def get_request(key, opts) key = prepend_prefix(@namespace, key) # In order to enforce the scope of the specified namespace, we are going to # intercept the zero-byte reference and re-target everything under the given namespace. if opts[:range_end] =~ /\x00/ opts[:range_end] = (@namespace[0..-2] + (@namespace[-1].ord + 1).chr) else opts[:range_end] = prepend_prefix(@namespace, opts[:range_end]) if opts[:range_end] end opts[:sort_order] = SORT_ORDER[opts[:sort_order]] \ if opts[:sort_order] opts[:sort_target] = SORT_TARGET[opts[:sort_target]] \ if opts[:sort_target] opts[:key] = key Etcdserverpb::RangeRequest.new(opts) end |
#put_request(key, value, lease = nil) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/etcdv3-0.11.5/lib/etcdv3/namespace/kv/requests.rb', line 47 def put_request(key, value, lease=nil) key = prepend_prefix(@namespace, key) kv = Etcdserverpb::PutRequest.new(key: key, value: value) kv.lease = lease if lease kv end |