Class: Riak::Client::BeefcakeProtobuffsBackend::TimeSeriesGetOperator
Instance Attribute Summary
Attributes inherited from Operator
Instance Method Summary collapse
- #get(table_name, key_components, options = {}) ⇒ Object
-
#initialize(backend, convert_timestamp) ⇒ TimeSeriesGetOperator
constructor
A new instance of TimeSeriesGetOperator.
Constructor Details
#initialize(backend, convert_timestamp) ⇒ TimeSeriesGetOperator
Returns a new instance of TimeSeriesGetOperator.
10 11 12 13 |
# File 'lib/riak/client/beefcake/time_series_get_operator.rb', line 10 def initialize(backend, ) super(backend) @convert_timestamp = end |
Instance Method Details
#get(table_name, key_components, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/riak/client/beefcake/time_series_get_operator.rb', line 15 def get(table_name, key_components, = {}) codec = TsCellCodec.new(@convert_timestamp) = .merge(table: table_name, key: codec.cells_for(key_components)) request = TsGetReq.new result = begin backend.protocol do |p| p.write :TsGetReq, request result = p.expect :TsGetResp, TsGetResp, empty_body_acceptable: true end rescue Riak::ProtobuffsErrorResponse => e raise unless e.code == 10 return nil end return nil if result == :empty Riak::TimeSeries::Collection.new(result.rows.map do |row| Riak::TimeSeries::Row.new codec.scalars_for row.cells end.to_a) end |