Class: Eternity::Index
- Inherits:
-
Object
- Object
- Eternity::Index
- Defined in:
- lib/eternity/index.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #apply(delta) ⇒ Object
-
#initialize(name = nil) ⇒ Index
constructor
A new instance of Index.
- #write_blob ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/eternity/index.rb', line 4 def name @name end |
Class Method Details
.all ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/eternity/index.rb', line 31 def self.all sections_count = Eternity.keyspace[:index].sections.count names = Eternity.connection.call('KEYS', Eternity.keyspace[:index]['*']).map do |key| Restruct::Id.new(key).sections[sections_count] end.uniq names.map { |name| new name } end |
Instance Method Details
#apply(delta) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/eternity/index.rb', line 12 def apply(delta) delta.each do |collection, elements| elements.each do |id, change| args = [id, change['data']].compact self[collection].send change['action'], *args end end end |