Class: Riak::TimeSeries::List

Inherits:
Object
  • Object
show all
Includes:
Util::Translation
Defined in:
lib/riak/time_series/list.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::Translation

#i18n_scope, #t

Constructor Details

#initialize(client, table_name) ⇒ List

Initializes but does not issue the list keys operation

Parameters:

  • client (Riak::Client)

    the Riak Client to list keys with

  • table_name (String)

    the table name to list keys in



29
30
31
32
33
# File 'lib/riak/time_series/list.rb', line 29

def initialize(client, table_name)
  @client = client
  @table_name = table_name
  @timeout = nil
end

Instance Attribute Details

#clientRiak::Client (readonly)

Returns the Riak client to use for the list keys operation.

Returns:

  • (Riak::Client)

    the Riak client to use for the list keys operation



14
15
16
# File 'lib/riak/time_series/list.rb', line 14

def client
  @client
end

#resultsRiak::TimeSeries::Collection<Riak::TimeSeries::Row> (readonly)

Returns each key as a row in a collection; nil if keys were streamed to a block.

Returns:



23
24
25
# File 'lib/riak/time_series/list.rb', line 23

def results
  @results
end

#table_nameString (readonly)

Returns the table name to list keys in.

Returns:

  • (String)

    the table name to list keys in



10
11
12
# File 'lib/riak/time_series/list.rb', line 10

def table_name
  @table_name
end

#timeoutInteger

Returns how many milliseconds Riak should wait for listing.

Returns:

  • (Integer)

    how many milliseconds Riak should wait for listing



18
19
20
# File 'lib/riak/time_series/list.rb', line 18

def timeout
  @timeout
end

Instance Method Details

#issue! {|key| ... } ⇒ Object

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

Yield Parameters:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 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