Class: Aerospike::HLLValue

Inherits:
Value
  • Object
show all
Defined in:
lib/aerospike/value/value.rb

Overview

HLLValue value. Encapsulates a HyperLogLog value. Supported by Aerospike server version 4.9 and later.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Value

of, validate_hash_key

Constructor Details

#initialize(value) ⇒ HLLValue

Returns a new instance of HLLValue.



530
531
532
533
534
535
# File 'lib/aerospike/value/value.rb', line 530

def initialize(value)
  @bytes = value
  @bytes.force_encoding("binary")

  self
end

Instance Attribute Details

#bytesObject (readonly)

:nodoc:



528
529
530
# File 'lib/aerospike/value/value.rb', line 528

def bytes
  @bytes
end

Instance Method Details

#==(other) ⇒ Object



537
538
539
# File 'lib/aerospike/value/value.rb', line 537

def ==(other)
  @bytes.to_s == other.to_s
end

#estimate_sizeObject



557
558
559
# File 'lib/aerospike/value/value.rb', line 557

def estimate_size
  @bytes.bytesize
end

#getObject



545
546
547
# File 'lib/aerospike/value/value.rb', line 545

def get
  self
end

#pack(packer) ⇒ Object



565
566
567
# File 'lib/aerospike/value/value.rb', line 565

def pack(packer)
  packer.write(Aerospike::ParticleType::BLOB.chr + @bytes)
end

#to_bytesObject



553
554
555
# File 'lib/aerospike/value/value.rb', line 553

def to_bytes
  @bytes
end

#to_sObject



549
550
551
# File 'lib/aerospike/value/value.rb', line 549

def to_s
  @bytes.to_s
end

#typeObject



541
542
543
# File 'lib/aerospike/value/value.rb', line 541

def type
  Aerospike::ParticleType::HLL
end

#write(buffer, offset) ⇒ Object



561
562
563
# File 'lib/aerospike/value/value.rb', line 561

def write(buffer, offset)
  buffer.write_binary(@bytes, offset)
end