Class: Riak::Crdt::HyperLogLog::BatchHyperLogLog

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

Instance Method Summary collapse

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

#operationsObject



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_aObject



94
95
96
# File 'lib/riak/crdt/hyper_log_log.rb', line 94

def to_a
  @adds.to_a
end

#valueObject



98
99
100
# File 'lib/riak/crdt/hyper_log_log.rb', line 98

def value
  @adds
end