Class: Aerospike::BatchDelete

Inherits:
BatchRecord show all
Defined in:
lib/aerospike/batch_delete.rb

Overview

Batch delete operation.

Constant Summary collapse

DEFAULT_BATCH_DELETE_POLICY =
BatchDeletePolicy.new

Instance Attribute Summary collapse

Attributes inherited from BatchRecord

#has_write, #in_doubt, #key, #record, #result_code

Instance Method Summary collapse

Methods inherited from BatchRecord

create_policy, #prepare, #set_error

Constructor Details

#initialize(key, opt = {}) ⇒ BatchDelete

Initialize policy and key.



25
26
27
28
# File 'lib/aerospike/batch_delete.rb', line 25

def initialize(key, opt = {})
  super(key, has_write: true)
  @policy = BatchRecord.create_policy(opt, BatchDeletePolicy, DEFAULT_BATCH_DELETE_POLICY)
end

Instance Attribute Details

#policyObject

Optional delete policy.



22
23
24
# File 'lib/aerospike/batch_delete.rb', line 22

def policy
  @policy
end

Instance Method Details

#==(other) ⇒ Object

:nodoc:



30
31
32
# File 'lib/aerospike/batch_delete.rb', line 30

def ==(other) # :nodoc:
  other && other.instance_of?(self.class) && @policy == other.policy
end

#sizeObject

Return wire protocol size. For internal use only.



37
38
39
40
41
42
43
44
45
46
# File 'lib/aerospike/batch_delete.rb', line 37

def size # :nodoc:
  size = 6 # gen(2) + exp(4) = 6

  size += @policy&.filter_exp&.size if @policy&.filter_exp
  if @policy&.send_key
      size += @key.user_key.estimate_size + Aerospike::FIELD_HEADER_SIZE + 1
  end

  size
end