lib/aerospike/query/stream_command.rb
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" and "not found".
        # If other return codes are received, then abort the batch.
        case result_code
        when Aerospike::ResultCode::OK
          # noop
        when Aerospike::ResultCode::KEY_NOT_FOUND_ERROR
          # consume the rest of the input buffer from the socket
          read_bytes(receive_size - @data_offset) if @data_offset < receive_size
          return nil
        else
          raise Aerospike::Exceptions::Aerospike.new(result_code)
        end

        info3 = @data_buffer.read(3).ord

        # If cmd is the end marker of the response, do not proceed further
        return false if (info3 & INFO3_LAST) == INFO3_LAST

        generation = @data_buffer.read_int32(6)
        expiration = @data_buffer.read_int32(10)
        field_count = @data_buffer.read_int16(18)
        op_count = @data_buffer.read_int16(20)
        key = parse_key(field_count)

        if result_code == 0
          if @recordset.active?
            @recordset.records.enq(parse_record(key, op_count, generation, expiration))
          else
            expn = @recordset.is_scan? ? SCAN_TERMINATED_EXCEPTION : QUERY_TERMINATED_EXCEPTION
            raise expn
          end
        end
      end # while

      true
    end
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" and "not found".
        # If other return codes are received, then abort the batch.
        case result_code
        when Aerospike::ResultCode::OK
          # noop
        when Aerospike::ResultCode::KEY_NOT_FOUND_ERROR
          # consume the rest of the input buffer from the socket
          read_bytes(receive_size - @data_offset) if @data_offset < receive_size
          return nil
        else
          raise Aerospike::Exceptions::Aerospike.new(result_code)
        end

        info3 = @data_buffer.read(3).ord

        # If cmd is the end marker of the response, do not proceed further
        return false if (info3 & INFO3_LAST) == INFO3_LAST

        generation = @data_buffer.read_int32(6)
        expiration = @data_buffer.read_int32(10)
        field_count = @data_buffer.read_int16(18)
        op_count = @data_buffer.read_int16(20)
        key = parse_key(field_count)

        if result_code == 0
          if @recordset.active?
            @recordset.records.enq(parse_record(key, op_count, generation, expiration))
          else
            expn = @recordset.is_scan? ? SCAN_TERMINATED_EXCEPTION : QUERY_TERMINATED_EXCEPTION
            raise expn
          end
        end
      end # while

      true
    end
:nodoc: