Class: Aerospike::BatchDirectExistsCommand

Inherits:
BatchDirectCommand show all
Defined in:
lib/aerospike/command/batch_direct_exists_command.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from BatchDirectCommand

#batch, #bin_names, #key_map, #policy, #read_attr, #results

Instance Method Summary collapse

Methods inherited from BatchDirectCommand

#write_buffer

Methods inherited from MultiCommand

#compressed?, #get_node, #parse_group, #parse_key, #parse_record, #parse_result, #read_bytes, #skip_key, #stop, #valid?

Methods inherited from Command

#execute, #set_delete, #set_exists, #set_operate, #set_query, #set_read, #set_read_for_key_only, #set_read_header, #set_scan, #set_touch, #set_udf, #set_write, #write_bins

Constructor Details

#initialize(node, batch, policy, key_map, results) ⇒ BatchDirectExistsCommand

Returns a new instance of BatchDirectExistsCommand.



24
25
26
# File 'lib/aerospike/command/batch_direct_exists_command.rb', line 24

def initialize(node, batch, policy, key_map, results)
  super(node, batch, policy, key_map, nil, results, INFO1_READ | INFO1_NOBINDATA)
end

Instance Method Details

#parse_row(result_code) ⇒ Object

Parse all results in the batch. Add records to shared list. If the record was not found, the bins will be nil.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/aerospike/command/batch_direct_exists_command.rb', line 30

def parse_row(result_code)
  field_count = @data_buffer.read_int16(18)
  op_count = @data_buffer.read_int16(20)

  if op_count > 0
    raise Aerospike::Exceptions::Parse.new('Received bins that were not requested!')
  end

  key = parse_key(field_count)
  item = key_map[key.digest]

  if item
    index = item.index
    results[index] = (result_code == 0)
  else
    Aerospike::logger.debug("Unexpected batch key returned: #{key.namespace}, #{key.digest}")
  end
end