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.



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

#operationsObject



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_aObject



80
81
82
# File 'lib/riak/crdt/hyper_log_log.rb', line 80

def to_a
  @adds.to_a
end

#valueObject



84
85
86
# File 'lib/riak/crdt/hyper_log_log.rb', line 84

def value
  @adds
end