class Riak::Crdt::InnerMap
A map that exists inside a {TypedCollection} inside another map.
Attributes
counters[R]
flags[R]
maps[R]
name[RW]
parent[R]
The parent of this counter.
@api private
registers[R]
sets[R]
Public Class Methods
delete()
click to toggle source
@api private
# File lib/riak/crdt/inner_map.rb, line 55 def self.delete Operation::Delete.new.tap do |op| op.type = :map end end
new(parent, value = {})
click to toggle source
@api private
# File lib/riak/crdt/inner_map.rb, line 15 def initialize(parent, value = {}) @parent = parent @value = value.symbolize_keys initialize_collections end
Public Instance Methods
context?()
click to toggle source
# File lib/riak/crdt/inner_map.rb, line 61 def context? @parent.context? end
operate(inner_operation)
click to toggle source
@api private
# File lib/riak/crdt/inner_map.rb, line 23 def operate(inner_operation) wrapped_operation = Operation::Update.new.tap do |op| op.value = inner_operation op.type = :map end @parent.operate(name, wrapped_operation) end
pretty_print(pp)
click to toggle source
# File lib/riak/crdt/inner_map.rb, line 32 def pretty_print(pp) pp.object_group self do %w{counters flags maps registers sets}.each do |h| pp.comma_breakable pp.text "#{h}=" pp.pp send h end end end
pretty_print_cycle(pp)
click to toggle source
# File lib/riak/crdt/inner_map.rb, line 42 def pretty_print_cycle(pp) pp.text "InnerMap" end
to_value_h()
click to toggle source
# File lib/riak/crdt/inner_map.rb, line 46 def to_value_h %w{counters flags maps registers sets}.map do |k| [k, send(k).to_value_h] end.to_h end
Also aliased as: value
Private Instance Methods
initialize_collections()
click to toggle source
# File lib/riak/crdt/inner_map.rb, line 66 def initialize_collections @counters = TypedCollection.new InnerCounter, self, @value[:counters] @flags = TypedCollection.new InnerFlag, self, @value[:flags] @maps = TypedCollection.new InnerMap, self, @value[:maps] @registers = TypedCollection.new InnerRegister, self, @value[:registers] @sets = TypedCollection.new InnerSet, self, @value[:sets] end