class Riak::Crdt::BatchMap

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

Attributes

counters[R]
flags[R]
maps[R]
registers[R]
sets[R]

Public Class Methods

new(parent) click to toggle source

@api private

# File lib/riak/crdt/batch_map.rb, line 9
def initialize(parent)
  @parent = parent
  @queue = []

  initialize_collections
end

Public Instance Methods

operate(operation) click to toggle source

@api private

# File lib/riak/crdt/batch_map.rb, line 17
def operate(operation)
  @queue << operation
end
operations() click to toggle source

@api private

# 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

Private Instance Methods

initialize_collections() click to toggle source
# File lib/riak/crdt/batch_map.rb, line 32
def initialize_collections
  @counters = @parent.counters.reparent self
  @flags = @parent.flags.reparent self
  @maps = @parent.maps.reparent self
  @registers = @parent.registers.reparent self
  @sets = @parent.sets.reparent self
end