class Riak::TimeSeries::List

A request to list keys in a Riak Time Series collection. Very expensive, not recommended for use in production.

Attributes

client[R]

@!attribute [r] client @return [Riak::Client] the Riak client to use for the list keys operation

results[R]

@!attribute [r] results @return [Riak::TimeSeries::Collection<Riak::TimeSeries::Row>] each key

as a row in a collection; nil if keys were streamed to a block
table_name[R]

@!attribute [r] table_name @return [String] the table name to list keys in

timeout[RW]

@!attribute [rw] timeout @return [Integer] how many milliseconds Riak should wait for listing

Public Class Methods

new(client, table_name) click to toggle source

Initializes but does not issue the list keys operation

@param [Riak::Client] client the Riak Client to list keys with @param [String] table_name the table name to list keys in

# File lib/riak/time_series/list.rb, line 29
def initialize(client, table_name)
  @client = client
  @table_name = table_name
  @timeout = nil
end

Public Instance Methods

issue!(&block) click to toggle source

Issue the list keys request. Takes a block for streaming results, or sets the results read-only attribute iff no block is given.

@yieldparam key [Riak::TimeSeries::Row] a listed key

# File lib/riak/time_series/list.rb, line 39
def issue!(&block)
  list_keys_warning(caller)

  options = { timeout: self.timeout }

  potential_results = nil

  client.backend do |be|
    op = be.time_series_list_operator(client.convert_timestamp)
    potential_results = op.list(table_name, block, options)
  end

  return @results = potential_results unless block_given?

  true
end

Private Instance Methods

list_keys_warning(bound_caller) click to toggle source
# File lib/riak/time_series/list.rb, line 57
def list_keys_warning(bound_caller)
  return if Riak.disable_list_keys_warnings

  backtrace = bound_caller.join("\n    ")

  warn(t('time_series.list_keys'), backtrace: backtrace)
end