Class: Aerospike::ServerCommand
- Inherits:
-
MultiCommand
- Object
- Command
- MultiCommand
- Aerospike::ServerCommand
- Defined in:
- lib/aerospike/query/server_command.rb
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#statement ⇒ Object
Returns the value of attribute statement.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#write_policy ⇒ Object
Returns the value of attribute write_policy.
Instance Method Summary collapse
-
#initialize(cluster, node, policy, statement, background, task_id) ⇒ ServerCommand
constructor
A new instance of ServerCommand.
- #parse_row(result_code) ⇒ Object
- #write? ⇒ Boolean
- #write_buffer ⇒ Object
Methods inherited from MultiCommand
#compressed?, #get_node, #parse_group, #parse_key, #parse_record, #parse_result, #read_bytes, #skip_key, #stop, #valid?
Methods inherited from Command
#execute, #set_delete, #set_exists, #set_operate, #set_query, #set_read, #set_read_for_key_only, #set_read_header, #set_scan, #set_touch, #set_udf, #set_write, #write_bins
Constructor Details
#initialize(cluster, node, policy, statement, background, task_id) ⇒ ServerCommand
Returns a new instance of ServerCommand.
22 23 24 25 26 27 28 29 |
# File 'lib/aerospike/query/server_command.rb', line 22 def initialize(cluster, node, policy, statement, background, task_id) super(node) @statement = statement @task_id = task_id @cluster = cluster @policy = policy @background = background end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
20 21 22 |
# File 'lib/aerospike/query/server_command.rb', line 20 def background @background end |
#cluster ⇒ Object
Returns the value of attribute cluster.
20 21 22 |
# File 'lib/aerospike/query/server_command.rb', line 20 def cluster @cluster end |
#statement ⇒ Object
Returns the value of attribute statement.
20 21 22 |
# File 'lib/aerospike/query/server_command.rb', line 20 def statement @statement end |
#task_id ⇒ Object
Returns the value of attribute task_id.
20 21 22 |
# File 'lib/aerospike/query/server_command.rb', line 20 def task_id @task_id end |
#write_policy ⇒ Object
Returns the value of attribute write_policy.
20 21 22 |
# File 'lib/aerospike/query/server_command.rb', line 20 def write_policy @write_policy end |
Instance Method Details
#parse_row(result_code) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/aerospike/query/server_command.rb', line 39 def parse_row(result_code) field_count = @data_buffer.read_int16(18) result_code = @data_buffer.read(5).ord & 0xFF skip_key(field_count) if result_code != 0 if result_code == Aerospike::ResultCode::KEY_NOT_FOUND_ERROR return false end raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node]) end op_count = @data_buffer.read_int16(20) if op_count <= 0 return Record.new(@node, key, bins, generation, expiration) end unless valid? raise Aerospike::Exceptions::QueryTerminated end end |
#write? ⇒ Boolean
31 32 33 |
# File 'lib/aerospike/query/server_command.rb', line 31 def write? true end |
#write_buffer ⇒ Object
35 36 37 |
# File 'lib/aerospike/query/server_command.rb', line 35 def write_buffer set_query(@cluster, @policy, @statement, true, nil) end |