Class: Riak::Crdt::BatchMap

Inherits:
Object show all
Defined in:
lib/riak/crdt/batch_map.rb

Overview

A map that queues up its operations for the parent Map to send to Riak all at once.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ BatchMap

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BatchMap.



9
10
11
12
13
14
# File 'lib/riak/crdt/batch_map.rb', line 9

def initialize(parent)
  @parent = parent
  @queue = []

  initialize_collections
end

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



6
7
8
# File 'lib/riak/crdt/batch_map.rb', line 6

def counters
  @counters
end

#flagsObject (readonly)

Returns the value of attribute flags.



6
7
8
# File 'lib/riak/crdt/batch_map.rb', line 6

def flags
  @flags
end

#mapsObject (readonly)

Returns the value of attribute maps.



6
7
8
# File 'lib/riak/crdt/batch_map.rb', line 6

def maps
  @maps
end

#registersObject (readonly)

Returns the value of attribute registers.



6
7
8
# File 'lib/riak/crdt/batch_map.rb', line 6

def registers
  @registers
end

#setsObject (readonly)

Returns the value of attribute sets.



6
7
8
# File 'lib/riak/crdt/batch_map.rb', line 6

def sets
  @sets
end

Instance Method Details

#operate(operation) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/riak/crdt/batch_map.rb', line 17

def operate(operation)
  @queue << operation
end

#operationsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
28
29
# File 'lib/riak/crdt/batch_map.rb', line 22

def operations
  @queue.map do |q|
    Operation::Update.new.tap do |op|
      op.type = :map
      op.value = q
    end
  end
end