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


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)


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

def client
  @client
end

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


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

def results
  @results
end

#table_nameString (readonly)


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

def table_name
  @table_name
end

#timeoutInteger


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
55
# 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|
    potential_results = be.time_series_list_operator.list(table_name,
                                                          block,
                                                          options)
  end

  return @results = potential_results unless block_given?

  true
end