Class: Riak::Crdt::HyperLogLog::BatchHyperLogLog
- Defined in:
- lib/riak/crdt/hyper_log_log.rb
Instance Method Summary collapse
- #add(element) ⇒ Object
-
#initialize(base) ⇒ BatchHyperLogLog
constructor
A new instance of BatchHyperLogLog.
- #operations ⇒ Object
- #to_a ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(base) ⇒ BatchHyperLogLog
Returns a new instance of BatchHyperLogLog.
85 86 87 88 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 85 def initialize(base) @base = base @adds = ::Set.new end |
Instance Method Details
#add(element) ⇒ Object
90 91 92 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 90 def add(element) @adds.add element end |
#operations ⇒ Object
102 103 104 105 106 107 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 102 def operations Operation::Update.new.tap do |op| op.type = :hll op.value = {add: @adds.to_a} end end |
#to_a ⇒ Object
94 95 96 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 94 def to_a @adds.to_a end |
#value ⇒ Object
98 99 100 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 98 def value @adds end |