Class: Riak::TimeSeries::List
- 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
-
#client ⇒ Riak::Client
readonly
The Riak client to use for the list keys operation.
-
#results ⇒ Riak::TimeSeries::Collection<Riak::TimeSeries::Row>
readonly
Each key as a row in a collection; nil if keys were streamed to a block.
-
#table_name ⇒ String
readonly
The table name to list keys in.
-
#timeout ⇒ Integer
How many milliseconds Riak should wait for listing.
Instance Method Summary collapse
-
#initialize(client, table_name) ⇒ List
constructor
Initializes but does not issue the list keys operation.
-
#issue! {|key| ... } ⇒ Object
Issue the list keys request.
Methods included from Util::Translation
Constructor Details
#initialize(client, table_name) ⇒ List
Initializes but does not issue the list keys operation
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
#client ⇒ Riak::Client (readonly)
Returns 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 |
#results ⇒ Riak::TimeSeries::Collection<Riak::TimeSeries::Row> (readonly)
Returns each key as a row in a collection; nil if keys were streamed to a block.
23 24 25 |
# File 'lib/riak/time_series/list.rb', line 23 def results @results end |
#table_name ⇒ String (readonly)
Returns 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 |
#timeout ⇒ Integer
Returns 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.
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) = { timeout: self.timeout } potential_results = nil client.backend do |be| op = be.time_series_list_operator(client.) potential_results = op.list(table_name, block, ) end return @results = potential_results unless block_given? true end |