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 Method Summary collapse

Methods inherited from Value

of, validate_hash_key

Constructor Details

#initialize(value) ⇒ HLLValue

:nodoc:



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

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

  self
end

Instance Method Details

#estimate_sizeObject



570
571
572
# File 'lib/aerospike/value/value.rb', line 570

def estimate_size
  @bytes.bytesize
end

#getObject



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

def get
  self
end

#pack(packer) ⇒ Object



578
579
580
# File 'lib/aerospike/value/value.rb', line 578

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

#to_bytesObject



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

def to_bytes
  @bytes
end

#to_sObject



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

def to_s
  @bytes.to_s
end

#typeObject



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

def type
  Aerospike::ParticleType::HLL
end

#write(buffer, offset) ⇒ Object



574
575
576
# File 'lib/aerospike/value/value.rb', line 574

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