class Riak::Client::BeefcakeProtobuffsBackend::TimeSeriesPutOperator

Public Instance Methods

put(table_name, measurements) click to toggle source
# File lib/riak/client/beefcake/time_series_put_operator.rb, line 10
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 Instance Methods

rows_for(measurements) click to toggle source
# File lib/riak/client/beefcake/time_series_put_operator.rb, line 22
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