Skip to content

Commit

Permalink
chore: drop duplicated arg for BatchOperateCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
opti committed Oct 24, 2024
1 parent 84028e0 commit 2878dbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/aerospike/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def batch_operate(records, options = nil)
policy = create_policy(options, BatchPolicy, default_batch_policy)

execute_batch_operate_commands(policy, records) do |node, batch|
BatchOperateCommand.new(node, batch, policy, batch.records)
BatchOperateCommand.new(node, batch, policy)
end
end

Expand Down
15 changes: 7 additions & 8 deletions lib/aerospike/command/batch_operate_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ module Aerospike

class BatchOperateCommand < MultiCommand #:nodoc:

attr_accessor :batch, :policy, :attr, :records
attr_accessor :batch, :policy, :attr

def initialize(node, batch, policy, records)
def initialize(node, batch, policy)
super(node)
@batch = batch
@policy = policy
@records = records
end

def batch_flags
Expand All @@ -50,7 +49,7 @@ def write_buffer
@data_offset += FIELD_HEADER_SIZE + 4 + 1 # batch.keys.length + flags

prev = nil
@records.each do |record|
batch.records.each do |record|
key = record.key
@data_offset += key.digest.length + 4 # 4 byte batch offset

Expand Down Expand Up @@ -78,7 +77,7 @@ def write_buffer

prev = nil
attr = BatchAttr.new
batch.records.each_with_index do |record, index|
batch.each_record_with_index do |record, index|
@data_offset += @data_buffer.write_int32(index, @data_offset)
key = record.key
@data_offset += @data_buffer.write_binary(key.digest, @data_offset)
Expand Down Expand Up @@ -136,13 +135,13 @@ def parse_row(result_code)
op_count = @data_buffer.read_int16(20)

skip_key(field_count)
req_key = records[batch_index].key
req_key = batch.record_for_index(batch_index).key

records[batch_index].result_code = result_code
batch.record_for_index(batch_index).result_code = result_code
case result_code
when 0, ResultCode::UDF_BAD_RESPONSE
record = parse_record(req_key, op_count, generation, expiration)
records[batch_index].record = record
batch.record_for_index(batch_index).record = record
end
end

Expand Down

0 comments on commit 2878dbf

Please sign in to comment.