Sha256: 4a0b7670ceff5c2d54ce77cab205a64fcb3f2365a6c0929ddfd5a171a2b61036

Contents?: true

Size: 800 Bytes

Versions: 8

Compression:

Stored size: 800 Bytes

Contents

require_relative './ts_cell_codec'
require_relative './operator'

class Riak::Client::BeefcakeProtobuffsBackend
  def time_series_put_operator
    TimeSeriesPutOperator.new(self)
  end

  class TimeSeriesPutOperator < Operator
    def put(table_name, measurements)
      rows = rows_for measurements

      request = TsPutReq.new table: table_name, rows: rows

      backend.protocol do |p|
        p.write :TsPutReq, request
        p.expect :TsPutResp, TsPutResp, empty_body_acceptable: true
      end
    end

    private
    def rows_for(measurements)
      codec = TsCellCodec.new
      measurements.map do |measurement|
        # expect a measurement to be mappable
        TsRow.new(cells: measurement.map do |measure|
          codec.cell_for measure
        end)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
riak-client-2.6.0 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.5.0 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.4.1 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.4.0 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.4.0.pre1 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.3.2 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.3.1 lib/riak/client/beefcake/time_series_put_operator.rb
riak-client-2.3.0 lib/riak/client/beefcake/time_series_put_operator.rb