Method: Aerospike::ExistsCommand#parse_result

Defined in:
lib/aerospike/command/exists_command.rb

#parse_resultObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/aerospike/command/exists_command.rb', line 44

def parse_result
  # Read header.
  @conn.read(@data_buffer, MSG_TOTAL_HEADER_SIZE)

  result_code = @data_buffer.read(13).ord & 0xFF

  if result_code == 0
    @exists = true
    return
  end

  if result_code == Aerospike::ResultCode::KEY_NOT_FOUND_ERROR
    @exists = false
    return
  end

  if result_code == Aerospike::ResultCode::FILTERED_OUT
    if @policy.fail_on_filtered_out
      raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node])
    end
    @exists = true
    return
  end

  raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node])
end