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.
71 72 73 74 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 71 def initialize(base) @base = base @adds = ::Set.new end |
Instance Method Details
#add(element) ⇒ Object
76 77 78 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 76 def add(element) @adds.add element end |
#operations ⇒ Object
88 89 90 91 92 93 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 88 def operations Operation::Update.new.tap do |op| op.type = :hll op.value = {add: @adds.to_a} end end |
#to_a ⇒ Object
80 81 82 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 80 def to_a @adds.to_a end |
#value ⇒ Object
84 85 86 |
# File 'lib/riak/crdt/hyper_log_log.rb', line 84 def value @adds end |