Class: Aerospike::BatchPolicy

Inherits:
Policy
  • Object
show all
Defined in:
lib/aerospike/policy/batch_policy.rb

Overview

Container object for batch policy command.

Instance Attribute Summary collapse

Attributes inherited from Policy

#consistency_level, #fail_on_filtered_out, #filter_exp, #max_retries, #priority, #read_touch_ttl_percent, #replica, #sleep_between_retries, #socket_timeout, #timeout, #use_compression

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt = {}) ⇒ BatchPolicy

Returns a new instance of BatchPolicy.

[View source]

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/aerospike/policy/batch_policy.rb', line 26

def initialize(opt={})
  super

  # [:nodoc:]
  # DEPRECATED
  # This setting does not have any effect anymore.
  # Use old batch direct protocol where batch reads are handled by direct
  # low-level batch server database routines. The batch direct protocol can
  # be faster when there is a single namespace. But there is one important
  # drawback: The batch direct protocol will not proxy to a different
  # server node when the mapped node has migrated a record to another node
  # (resulting in not found record). This can happen after a node has been
  # added/removed from the cluster and there is a lag between records being
  # migrated and client partition map update (once per second). The batch
  # index protocol will perform this record proxy when necessary.
  #
  # Default: false (use new batch index protocol if server supports it)
  @use_batch_direct = opt.fetch(:use_batch_direct, false)


  # Allow batch to be processed immediately in the server's receiving thread for SSD
  # namespaces. If false, the batch will always be processed in separate service threads.
  # Server versions < 6.0 ignore this field.
  #
  # Inline processing can introduce the possibility of unfairness because the server
  # can process the entire batch before moving onto the next command.
  #
  # Default: false
  @allow_inline_ssd = opt.fetch(:allow_inline_ssd, false)


  # Should all batch keys be attempted regardless of errors. This field is used on both
  # the client and server. The client handles node specific errors and the server handles
  # key specific errors.
  #
  # If true, every batch key is attempted regardless of previous key specific errors.
  # Node specific errors such as timeouts stop keys to that node, but keys directed at
  # other nodes will continue to be processed.
  #
  # If false, the server will stop the batch to its node on most key specific errors.
  # The exceptions are {ResultCode#KEY_NOT_FOUND_ERROR} and
  # {ResultCode#FILTERED_OUT} which never stop the batch.
  # The client will stop the entire batch on node specific errors. The client will
  # not stop the entire batch commands run in parallel.
  #
  # Server versions < 6.0 do not support this field and treat this value as false
  # for key specific errors.
  #
  # Default: true
  @respond_all_keys = opt.fetch(:respond_all_keys, true)


  # Send user defined key in addition to hash digest on a record put.
  # The default is to _not_ send the user defined key.
  @send_key = opt.fetch(:send_key, false)

  self
end

Instance Attribute Details

#allow_inline_ssdObject

Returns the value of attribute allow_inline_ssd.


24
25
26
# File 'lib/aerospike/policy/batch_policy.rb', line 24

def allow_inline_ssd
  @allow_inline_ssd
end

#respond_all_keysObject

Returns the value of attribute respond_all_keys.


24
25
26
# File 'lib/aerospike/policy/batch_policy.rb', line 24

def respond_all_keys
  @respond_all_keys
end

#send_keyObject

Returns the value of attribute send_key.


24
25
26
# File 'lib/aerospike/policy/batch_policy.rb', line 24

def send_key
  @send_key
end

Class Method Details

.read_defaultObject

[View source]

85
86
87
# File 'lib/aerospike/policy/batch_policy.rb', line 85

def self.read_default
  BatchPolicy.new
end

.write_defaultObject

[View source]

89
90
91
92
93
# File 'lib/aerospike/policy/batch_policy.rb', line 89

def self.write_default
  bp = BatchPolicy.new
  bp.max_retries = 0
  bp
end