Class: Aerospike::BatchRecord
- Inherits:
-
Object
- Object
- Aerospike::BatchRecord
- Defined in:
- lib/aerospike/batch_record.rb
Overview
Batch key and record result.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#has_write ⇒ Object
readonly
Does this command contain a write operation.
-
#in_doubt ⇒ Object
Is it possible that the write transaction may have completed even though an error occurred for this record.
-
#key ⇒ Object
readonly
Key.
-
#record ⇒ Object
Record result after batch command has completed.
-
#result_code ⇒ Object
Result code for this returned record.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, result_code: ResultCode::NO_RESPONSE, in_doubt: false, has_write: false) ⇒ BatchRecord
constructor
Constructor.
-
#prepare ⇒ Object
Prepare for upcoming batch call.
-
#set_error(result_code, in_doubt) ⇒ Object
Set error result.
Constructor Details
#initialize(key, result_code: ResultCode::NO_RESPONSE, in_doubt: false, has_write: false) ⇒ BatchRecord
Constructor.
41 42 43 44 45 46 47 |
# File 'lib/aerospike/batch_record.rb', line 41 def initialize(key, result_code: ResultCode::NO_RESPONSE, in_doubt: false, has_write: false) @key = key @record = record @result_code = result_code @in_doubt = in_doubt @has_write = has_write end |
Instance Attribute Details
#has_write ⇒ Object (readonly)
Does this command contain a write operation. For internal use only.
38 39 40 |
# File 'lib/aerospike/batch_record.rb', line 38 def has_write @has_write end |
#in_doubt ⇒ Object
Is it possible that the write transaction may have completed even though an error occurred for this record. This may be the case when a client error occurs (like timeout) after the command was sent to the server.
35 36 37 |
# File 'lib/aerospike/batch_record.rb', line 35 def in_doubt @in_doubt end |
#key ⇒ Object (readonly)
Key.
22 23 24 |
# File 'lib/aerospike/batch_record.rb', line 22 def key @key end |
#record ⇒ Object
Record result after batch command has completed. Will be null if record was not found or an error occurred. See #result_code.
26 27 28 |
# File 'lib/aerospike/batch_record.rb', line 26 def record @record end |
#result_code ⇒ Object
Result code for this returned record. See ResultCode. If not ResultCode#OK, the record will be null.
30 31 32 |
# File 'lib/aerospike/batch_record.rb', line 30 def result_code @result_code end |
Class Method Details
.create_policy(policy, policy_klass, default_policy = nil) ⇒ Object
:nodoc:
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/aerospike/batch_record.rb', line 49 def self.create_policy(policy, policy_klass, default_policy = nil) # :nodoc: case policy when nil default_policy || policy_klass.new when policy_klass policy when Hash policy_klass.new(policy) else raise TypeError, "policy should be a #{policy_klass.name} instance or a Hash" end end |
Instance Method Details
#prepare ⇒ Object
Prepare for upcoming batch call. Reset result fields because this instance might be reused. For internal use only.
64 65 66 67 68 |
# File 'lib/aerospike/batch_record.rb', line 64 def prepare # :nodoc: @record = nil @result_code = ResultCode::NO_RESPONSE @in_doubt = false end |
#set_error(result_code, in_doubt) ⇒ Object
Set error result. For internal use only.
77 78 79 80 |
# File 'lib/aerospike/batch_record.rb', line 77 def set_error(result_code, in_doubt) # :nodoc: @result_code = result_code @in_doubt = in_doubt end |