Class: Riak::Client::BeefcakeProtobuffsBackend::CrdtLoader Private
- Includes:
- Util::Translation
- Defined in:
- lib/riak/client/beefcake/crdt_loader.rb,
lib/riak/client/beefcake/crdt/map_loader.rb,
lib/riak/client/beefcake/crdt/set_loader.rb,
lib/riak/client/beefcake/crdt/counter_loader.rb,
lib/riak/client/beefcake/crdt/hyper_log_log_loader.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Loads, and deserializes CRDTs from protobuffs into Ruby hashes, sets, strings, and integers.
Defined Under Namespace
Classes: CounterLoader, HyperLogLogLoader, MapLoader, SetLoader
Instance Attribute Summary collapse
- #backend ⇒ Object readonly private
- #context ⇒ Object readonly private
Instance Method Summary collapse
- #get_loader_for_value(value) ⇒ Object private
-
#initialize(backend) ⇒ CrdtLoader
constructor
private
A new instance of CrdtLoader.
-
#load(bucket, key, bucket_type, options = {}) ⇒ Object
private
Perform the protobuffs request and return a deserialized CRDT.
Methods included from Util::Translation
Constructor Details
#initialize(backend) ⇒ CrdtLoader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CrdtLoader.
25 26 27 |
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 25 def initialize(backend) @backend = backend end |
Instance Attribute Details
#backend ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 23 def backend @backend end |
#context ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 23 def context @context end |
Instance Method Details
#get_loader_for_value(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 51 52 53 54 |
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 48 def get_loader_for_value(value) return nil if value.nil? [CounterLoader, HyperLogLogLoader, MapLoader, SetLoader].map do |loader| loader.for_value value end.compact.first end |
#load(bucket, key, bucket_type, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Perform the protobuffs request and return a deserialized CRDT.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/riak/client/beefcake/crdt_loader.rb', line 30 def load(bucket, key, bucket_type, = {}) bucket = bucket.name if bucket.is_a? ::Riak::Bucket fetch_args = .merge( bucket: bucket, key: key, type: bucket_type ) request = DtFetchReq.new fetch_args response = backend.protocol do |p| p.write :DtFetchReq, request p.expect :DtFetchResp, DtFetchResp end @context = response.context rubyfy response end |