Class: Aerospike::Policy
- Inherits:
-
Object
- Object
- Aerospike::Policy
- Defined in:
- lib/aerospike/policy/policy.rb
Overview
Container object for client policy command.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#consistency_level ⇒ Object
Returns the value of attribute consistency_level.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#sleep_between_retries ⇒ Object
Returns the value of attribute sleep_between_retries.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ Policy
constructor
A new instance of Policy.
Constructor Details
#initialize(opt = {}) ⇒ Policy
Returns a new instance of Policy.
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 |
# File 'lib/aerospike/policy/policy.rb', line 27 def initialize(opt={}) # Container object for transaction policy attributes used in all database # operation calls. # Priority of request relative to other transactions. # Currently, only used for scans. @priority = opt[:priority] || Priority::DEFAULT # How replicas should be consulted in a read operation to provide the desired # consistency guarantee. Default to allowing one replica to be used in the # read operation. @consistency_level = opt[:consistency_level] || Aerospike::ConsistencyLevel::CONSISTENCY_ONE # Transaction timeout. # This timeout is used to set the socket timeout and is also sent to the # server along with the transaction in the wire protocol. # Default to no timeout (0). @timeout = opt[:timeout] || 0 # Maximum number of retries before aborting the current transaction. # A retry is attempted when there is a network error other than timeout. # If max_retries is exceeded, the abort will occur even if the timeout # has not yet been exceeded. @max_retries = opt[:max_retiries] || 2 # Duration to sleep between retries if a transaction fails and the # timeout was not exceeded. Enter zero to skip sleep. @sleep_between_retries = opt[:sleep_between_retries] || 0.5 end |
Instance Attribute Details
#consistency_level ⇒ Object
Returns the value of attribute consistency_level.
25 26 27 |
# File 'lib/aerospike/policy/policy.rb', line 25 def consistency_level @consistency_level end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
25 26 27 |
# File 'lib/aerospike/policy/policy.rb', line 25 def max_retries @max_retries end |
#priority ⇒ Object
Returns the value of attribute priority.
25 26 27 |
# File 'lib/aerospike/policy/policy.rb', line 25 def priority @priority end |
#sleep_between_retries ⇒ Object
Returns the value of attribute sleep_between_retries.
25 26 27 |
# File 'lib/aerospike/policy/policy.rb', line 25 def sleep_between_retries @sleep_between_retries end |
#timeout ⇒ Object
Returns the value of attribute timeout.
25 26 27 |
# File 'lib/aerospike/policy/policy.rb', line 25 def timeout @timeout end |