Method: Aerospike::BatchRead#size

Defined in:
lib/aerospike/batch_read.rb

#sizeObject

Return wire protocol size. For internal use only.

[View source]

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/aerospike/batch_read.rb', line 78

def size # :nodoc:
  size = 0
  size += @policy&.filter_exp&.size if @policy&.filter_exp

  @bin_names&.each do |bin_name|
    size += bin_name.bytesize + Aerospike::OPERATION_HEADER_SIZE
  end

  @ops&.each do |op|
    if op.is_write?
      raise AerospikeException.new(ResultCode::PARAMETER_ERROR, "Write operations not allowed in batch read")
    end
    size += op.bin_name.bytesize + Aerospike::OPERATION_HEADER_SIZE
    size += op.bin_value.estimate_size
  end

  size
end