Class: Riagent::Persistence::RiakNoIndexStrategy

Inherits:
RiakKVStrategy show all
Defined in:
lib/riagent/persistence/riak_no_index_strategy.rb

Instance Attribute Summary

Attributes inherited from RiakKVStrategy

#bucket

Attributes inherited from PersistenceStrategy

#client, #collection_name, #model_class

Instance Method Summary collapse

Methods inherited from RiakKVStrategy

#allows_query?, #client, #find, #from_riak_object, #insert, #new_riak_object, #remove, #update

Methods inherited from PersistenceStrategy

#initialize

Constructor Details

This class inherits a constructor from Riagent::Persistence::PersistenceStrategy

Instance Method Details

#all(results_limit) ⇒ Array<Riagent::ActiveDocument>

Return all the documents in the collection. Since this is a “no index” strategy, this can only be done via a streaming list keys

Parameters:

  • results_limit (Integer)

    Number of results returned (currently ignored)

Returns:



31
32
33
34
35
36
# File 'lib/riagent/persistence/riak_no_index_strategy.rb', line 31

def all(results_limit)
  self.bucket.keys.inject([]) do |acc, k|
    obj = self.find(k)
    obj ? acc << obj : acc
  end
end