Method: Aerospike::MultiCommand#parse_group

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

#parse_group(receive_size) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/aerospike/command/multi_command.rb', line 94

def parse_group(receive_size)
  @data_offset = 0

  while @data_offset < receive_size
    read_bytes(MSG_REMAINING_HEADER_SIZE)
    result_code = @data_buffer.read(5).ord & 0xFF

    # The only valid server return codes are "ok", "not found" and "filtered out".
    # If other return codes are received, then abort the batch.
    if result_code != 0
        if [Aerospike::ResultCode::KEY_NOT_FOUND_ERROR, Aerospike::ResultCode::FILTERED_OUT].include?(result_code)
          # NOOP
        else
          raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node])
        end
    end

    # If cmd is the end marker of the response, do not proceed further
    info3 = @data_buffer.read(3).ord
    return false if (info3 & INFO3_LAST) == INFO3_LAST

    parse_row(result_code)
  end

  true
end