Class: Aerospike::WriteCommand
Overview
Instance Method Summary
collapse
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
Constructor Details
#initialize(cluster, policy, key, bins, operation) ⇒ WriteCommand
Returns a new instance of WriteCommand.
25
26
27
28
29
30
31
32
33
|
# File 'lib/aerospike/command/write_command.rb', line 25
def initialize(cluster, policy, key, bins, operation)
super(cluster, key)
@bins = bins
@operation = operation
@policy = policy
self
end
|
Instance Method Details
#get_node ⇒ Object
35
36
37
|
# File 'lib/aerospike/command/write_command.rb', line 35
def get_node
@cluster.master_node(@partition)
end
|
#parse_result ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/aerospike/command/write_command.rb', line 47
def parse_result
begin
@conn.read(@data_buffer, MSG_TOTAL_HEADER_SIZE)
rescue => e
Aerospike.logger.error(e)
raise e
end
result_code = @data_buffer.read(13).ord & 0xFF
return if result_code == 0
if result_code == Aerospike::ResultCode::FILTERED_OUT
if @policy.fail_on_filtered_out
raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node])
end
return
end
raise Aerospike::Exceptions::Aerospike.new(result_code, nil, [@node])
end
|
#write_bins ⇒ Object
39
40
41
|
# File 'lib/aerospike/command/write_command.rb', line 39
def write_bins
@bins
end
|
#write_buffer ⇒ Object
43
44
45
|
# File 'lib/aerospike/command/write_command.rb', line 43
def write_buffer
set_write(@policy, @operation, @key, @bins)
end
|