aerospike 3.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +13 -9
- data/lib/aerospike/batch_attr.rb +292 -0
- data/lib/aerospike/batch_delete.rb +48 -0
- data/lib/aerospike/batch_read.rb +97 -0
- data/lib/aerospike/batch_record.rb +83 -0
- data/lib/aerospike/batch_results.rb +38 -0
- data/lib/aerospike/batch_udf.rb +76 -0
- data/lib/aerospike/batch_write.rb +79 -0
- data/lib/aerospike/cdt/bit_operation.rb +4 -5
- data/lib/aerospike/cdt/map_return_type.rb +8 -0
- data/lib/aerospike/client.rb +37 -51
- data/lib/aerospike/cluster.rb +50 -46
- data/lib/aerospike/command/batch_index_command.rb +7 -11
- data/lib/aerospike/command/batch_index_node.rb +3 -4
- data/lib/aerospike/command/batch_operate_command.rb +151 -0
- data/lib/aerospike/command/batch_operate_node.rb +51 -0
- data/lib/aerospike/command/command.rb +125 -98
- data/lib/aerospike/command/single_command.rb +1 -1
- data/lib/aerospike/exp/exp.rb +39 -41
- data/lib/aerospike/exp/exp_bit.rb +24 -24
- data/lib/aerospike/exp/exp_hll.rb +12 -12
- data/lib/aerospike/exp/exp_list.rb +101 -92
- data/lib/aerospike/exp/exp_map.rb +116 -119
- data/lib/aerospike/exp/operation.rb +2 -2
- data/lib/aerospike/info.rb +2 -4
- data/lib/aerospike/node.rb +7 -3
- data/lib/aerospike/operation.rb +38 -0
- data/lib/aerospike/policy/batch_delete_policy.rb +71 -0
- data/lib/aerospike/policy/batch_policy.rb +53 -4
- data/lib/aerospike/policy/batch_read_policy.rb +55 -0
- data/lib/aerospike/policy/batch_udf_policy.rb +75 -0
- data/lib/aerospike/policy/batch_write_policy.rb +105 -0
- data/lib/aerospike/policy/policy.rb +20 -40
- data/lib/aerospike/policy/query_duration.rb +48 -0
- data/lib/aerospike/policy/query_policy.rb +13 -8
- data/lib/aerospike/query/server_command.rb +1 -0
- data/lib/aerospike/query/statement.rb +5 -21
- data/lib/aerospike/result_code.rb +7 -1
- data/lib/aerospike/utils/buffer.rb +15 -15
- data/lib/aerospike/version.rb +1 -1
- data/lib/aerospike.rb +14 -12
- metadata +17 -14
- data/lib/aerospike/command/batch_direct_command.rb +0 -105
- data/lib/aerospike/command/batch_direct_exists_command.rb +0 -51
- data/lib/aerospike/command/batch_direct_node.rb +0 -40
- data/lib/aerospike/query/pred_exp/and_or.rb +0 -32
- data/lib/aerospike/query/pred_exp/geo_json_value.rb +0 -41
- data/lib/aerospike/query/pred_exp/integer_value.rb +0 -32
- data/lib/aerospike/query/pred_exp/op.rb +0 -27
- data/lib/aerospike/query/pred_exp/regex.rb +0 -32
- data/lib/aerospike/query/pred_exp/regex_flags.rb +0 -23
- data/lib/aerospike/query/pred_exp/string_value.rb +0 -29
- data/lib/aerospike/query/pred_exp.rb +0 -192
@@ -25,7 +25,7 @@ module Aerospike
|
|
25
25
|
# Buffer class to ease the work around
|
26
26
|
class Buffer #:nodoc:
|
27
27
|
@@buf_pool = Pool.new
|
28
|
-
@@buf_pool.create_proc =
|
28
|
+
@@buf_pool.create_proc = proc { Buffer.new }
|
29
29
|
|
30
30
|
attr_accessor :buf
|
31
31
|
|
@@ -43,7 +43,7 @@ module Aerospike
|
|
43
43
|
MAX_BUFFER_SIZE = 10 * 1024 * 1024
|
44
44
|
|
45
45
|
def initialize(size = DEFAULT_BUFFER_SIZE, buf = nil)
|
46
|
-
@buf =
|
46
|
+
@buf = buf || format("%0#{size}d", 0)
|
47
47
|
@buf.force_encoding("binary")
|
48
48
|
@slice_end = @buf.bytesize
|
49
49
|
end
|
@@ -60,7 +60,7 @@ module Aerospike
|
|
60
60
|
@buf.bytesize
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
alias length size
|
64
64
|
|
65
65
|
def eat!(n)
|
66
66
|
@buf.replace(@buf[n..-1])
|
@@ -74,7 +74,7 @@ module Aerospike
|
|
74
74
|
end
|
75
75
|
|
76
76
|
if @buf.bytesize < length
|
77
|
-
@buf.concat("%0#{length - @buf.bytesize}d"
|
77
|
+
@buf.concat(format("%0#{length - @buf.bytesize}d", 0))
|
78
78
|
end
|
79
79
|
@slice_end = length
|
80
80
|
end
|
@@ -144,37 +144,37 @@ module Aerospike
|
|
144
144
|
|
145
145
|
def read_int16(offset)
|
146
146
|
vals = @buf[offset..offset + 1]
|
147
|
-
vals.
|
147
|
+
vals.unpack1(INT16)
|
148
148
|
end
|
149
149
|
|
150
150
|
def read_uint16(offset)
|
151
151
|
vals = @buf[offset..offset + 1]
|
152
|
-
vals.
|
152
|
+
vals.unpack1(UINT16)
|
153
153
|
end
|
154
154
|
|
155
155
|
def read_int32(offset)
|
156
156
|
vals = @buf[offset..offset + 3]
|
157
|
-
vals.
|
157
|
+
vals.unpack1(INT32)
|
158
158
|
end
|
159
159
|
|
160
160
|
def read_uint32(offset)
|
161
161
|
vals = @buf[offset..offset + 3]
|
162
|
-
vals.
|
162
|
+
vals.unpack1(UINT32)
|
163
163
|
end
|
164
164
|
|
165
165
|
def read_int64(offset)
|
166
166
|
vals = @buf[offset..offset + 7]
|
167
|
-
vals.
|
167
|
+
vals.unpack1(INT64)
|
168
168
|
end
|
169
169
|
|
170
170
|
def read_uint64_little_endian(offset)
|
171
171
|
vals = @buf[offset..offset + 7]
|
172
|
-
vals.
|
172
|
+
vals.unpack1(UINT64LE)
|
173
173
|
end
|
174
174
|
|
175
175
|
def read_uint64(offset)
|
176
176
|
vals = @buf[offset..offset + 7]
|
177
|
-
vals.
|
177
|
+
vals.unpack1(UINT64)
|
178
178
|
end
|
179
179
|
|
180
180
|
def read_var_int64(offset, len)
|
@@ -190,7 +190,7 @@ module Aerospike
|
|
190
190
|
|
191
191
|
def read_double(offset)
|
192
192
|
vals = @buf[offset..offset + 7]
|
193
|
-
vals.
|
193
|
+
vals.unpack1(DOUBLE)
|
194
194
|
end
|
195
195
|
|
196
196
|
def read_bool(offset, length)
|
@@ -219,13 +219,13 @@ module Aerospike
|
|
219
219
|
@buf.bytes[start...finish].each do |c|
|
220
220
|
if counter >= start
|
221
221
|
print "%02x " % c
|
222
|
-
ascii << (c.between?(32, 126) ? c :
|
223
|
-
print " " if ascii.length == (width / 2 + 1)
|
222
|
+
ascii << (c.between?(32, 126) ? c : '.')
|
223
|
+
print " " if ascii.length == ((width / 2) + 1)
|
224
224
|
if ascii.length > width
|
225
225
|
ascii << "|"
|
226
226
|
puts ascii
|
227
227
|
ascii = "|"
|
228
|
-
print "%08x "
|
228
|
+
print format("%08x ", (counter + 1))
|
229
229
|
end
|
230
230
|
end
|
231
231
|
counter += 1
|
data/lib/aerospike/version.rb
CHANGED
data/lib/aerospike.rb
CHANGED
@@ -43,8 +43,8 @@ require "aerospike/version"
|
|
43
43
|
require "aerospike/value/particle_type"
|
44
44
|
require "aerospike/value/value"
|
45
45
|
require "aerospike/command/single_command"
|
46
|
-
require "aerospike/command/batch_direct_node"
|
47
46
|
require "aerospike/command/batch_index_node"
|
47
|
+
require "aerospike/command/batch_operate_node"
|
48
48
|
require "aerospike/command/field_type"
|
49
49
|
require "aerospike/command/command"
|
50
50
|
require "aerospike/command/execute_command"
|
@@ -53,9 +53,8 @@ require "aerospike/command/batch_item"
|
|
53
53
|
require "aerospike/command/operate_command"
|
54
54
|
require "aerospike/command/exists_command"
|
55
55
|
require "aerospike/command/multi_command"
|
56
|
-
require "aerospike/command/batch_direct_command"
|
57
|
-
require "aerospike/command/batch_direct_exists_command"
|
58
56
|
require "aerospike/command/batch_index_command"
|
57
|
+
require "aerospike/command/batch_operate_command"
|
59
58
|
require "aerospike/command/batch_index_exists_command"
|
60
59
|
require "aerospike/command/read_header_command"
|
61
60
|
require "aerospike/command/touch_command"
|
@@ -91,12 +90,17 @@ require "aerospike/cdt/bit_policy"
|
|
91
90
|
require "aerospike/geo_json"
|
92
91
|
require "aerospike/ttl"
|
93
92
|
|
93
|
+
require "aerospike/policy/query_duration"
|
94
94
|
require "aerospike/policy/client_policy"
|
95
95
|
require "aerospike/policy/priority"
|
96
96
|
require "aerospike/policy/record_exists_action"
|
97
97
|
require "aerospike/policy/generation_policy"
|
98
98
|
require "aerospike/policy/policy"
|
99
99
|
require "aerospike/policy/batch_policy"
|
100
|
+
require "aerospike/policy/batch_delete_policy"
|
101
|
+
require "aerospike/policy/batch_read_policy"
|
102
|
+
require "aerospike/policy/batch_udf_policy"
|
103
|
+
require "aerospike/policy/batch_write_policy"
|
100
104
|
require "aerospike/policy/write_policy"
|
101
105
|
require "aerospike/policy/scan_policy"
|
102
106
|
require "aerospike/policy/query_policy"
|
@@ -105,6 +109,13 @@ require "aerospike/policy/commit_level"
|
|
105
109
|
require "aerospike/policy/admin_policy"
|
106
110
|
require "aerospike/policy/auth_mode"
|
107
111
|
|
112
|
+
require "aerospike/batch_record"
|
113
|
+
require "aerospike/batch_attr"
|
114
|
+
require "aerospike/batch_read"
|
115
|
+
require "aerospike/batch_write"
|
116
|
+
require "aerospike/batch_delete"
|
117
|
+
require "aerospike/batch_udf"
|
118
|
+
|
108
119
|
require "aerospike/socket/base"
|
109
120
|
require "aerospike/socket/ssl"
|
110
121
|
require "aerospike/socket/tcp"
|
@@ -160,7 +171,6 @@ require "aerospike/query/stream_command"
|
|
160
171
|
require "aerospike/query/query_command"
|
161
172
|
require "aerospike/query/scan_command"
|
162
173
|
require "aerospike/query/statement"
|
163
|
-
require "aerospike/query/pred_exp"
|
164
174
|
require "aerospike/query/partition_tracker"
|
165
175
|
require "aerospike/query/partition_status"
|
166
176
|
require "aerospike/query/partition_filter"
|
@@ -178,14 +188,6 @@ require "aerospike/exp/exp_bit"
|
|
178
188
|
require "aerospike/exp/exp_hll"
|
179
189
|
require "aerospike/exp/operation"
|
180
190
|
|
181
|
-
require "aerospike/query/pred_exp/and_or"
|
182
|
-
require "aerospike/query/pred_exp/geo_json_value"
|
183
|
-
require "aerospike/query/pred_exp/integer_value"
|
184
|
-
require "aerospike/query/pred_exp/op"
|
185
|
-
require "aerospike/query/pred_exp/regex"
|
186
|
-
require "aerospike/query/pred_exp/regex_flags"
|
187
|
-
require "aerospike/query/pred_exp/string_value"
|
188
|
-
|
189
191
|
module Aerospike
|
190
192
|
extend Loggable
|
191
193
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aerospike
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khosrow Afroozeh
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: msgpack
|
@@ -56,6 +56,13 @@ files:
|
|
56
56
|
- lib/aerospike.rb
|
57
57
|
- lib/aerospike/aerospike_exception.rb
|
58
58
|
- lib/aerospike/atomic/atomic.rb
|
59
|
+
- lib/aerospike/batch_attr.rb
|
60
|
+
- lib/aerospike/batch_delete.rb
|
61
|
+
- lib/aerospike/batch_read.rb
|
62
|
+
- lib/aerospike/batch_record.rb
|
63
|
+
- lib/aerospike/batch_results.rb
|
64
|
+
- lib/aerospike/batch_udf.rb
|
65
|
+
- lib/aerospike/batch_write.rb
|
59
66
|
- lib/aerospike/bin.rb
|
60
67
|
- lib/aerospike/cdt/bit_operation.rb
|
61
68
|
- lib/aerospike/cdt/bit_overflow_action.rb
|
@@ -87,13 +94,12 @@ files:
|
|
87
94
|
- lib/aerospike/cluster/partition_parser.rb
|
88
95
|
- lib/aerospike/cluster/rack_parser.rb
|
89
96
|
- lib/aerospike/command/admin_command.rb
|
90
|
-
- lib/aerospike/command/batch_direct_command.rb
|
91
|
-
- lib/aerospike/command/batch_direct_exists_command.rb
|
92
|
-
- lib/aerospike/command/batch_direct_node.rb
|
93
97
|
- lib/aerospike/command/batch_index_command.rb
|
94
98
|
- lib/aerospike/command/batch_index_exists_command.rb
|
95
99
|
- lib/aerospike/command/batch_index_node.rb
|
96
100
|
- lib/aerospike/command/batch_item.rb
|
101
|
+
- lib/aerospike/command/batch_operate_command.rb
|
102
|
+
- lib/aerospike/command/batch_operate_node.rb
|
97
103
|
- lib/aerospike/command/command.rb
|
98
104
|
- lib/aerospike/command/delete_command.rb
|
99
105
|
- lib/aerospike/command/execute_command.rb
|
@@ -148,7 +154,11 @@ files:
|
|
148
154
|
- lib/aerospike/peers/parse.rb
|
149
155
|
- lib/aerospike/policy/admin_policy.rb
|
150
156
|
- lib/aerospike/policy/auth_mode.rb
|
157
|
+
- lib/aerospike/policy/batch_delete_policy.rb
|
151
158
|
- lib/aerospike/policy/batch_policy.rb
|
159
|
+
- lib/aerospike/policy/batch_read_policy.rb
|
160
|
+
- lib/aerospike/policy/batch_udf_policy.rb
|
161
|
+
- lib/aerospike/policy/batch_write_policy.rb
|
152
162
|
- lib/aerospike/policy/client_policy.rb
|
153
163
|
- lib/aerospike/policy/commit_level.rb
|
154
164
|
- lib/aerospike/policy/consistency_level.rb
|
@@ -156,6 +166,7 @@ files:
|
|
156
166
|
- lib/aerospike/policy/operate_policy.rb
|
157
167
|
- lib/aerospike/policy/policy.rb
|
158
168
|
- lib/aerospike/policy/priority.rb
|
169
|
+
- lib/aerospike/policy/query_duration.rb
|
159
170
|
- lib/aerospike/policy/query_policy.rb
|
160
171
|
- lib/aerospike/policy/record_bin_multiplicity.rb
|
161
172
|
- lib/aerospike/policy/record_exists_action.rb
|
@@ -168,14 +179,6 @@ files:
|
|
168
179
|
- lib/aerospike/query/partition_filter.rb
|
169
180
|
- lib/aerospike/query/partition_status.rb
|
170
181
|
- lib/aerospike/query/partition_tracker.rb
|
171
|
-
- lib/aerospike/query/pred_exp.rb
|
172
|
-
- lib/aerospike/query/pred_exp/and_or.rb
|
173
|
-
- lib/aerospike/query/pred_exp/geo_json_value.rb
|
174
|
-
- lib/aerospike/query/pred_exp/integer_value.rb
|
175
|
-
- lib/aerospike/query/pred_exp/op.rb
|
176
|
-
- lib/aerospike/query/pred_exp/regex.rb
|
177
|
-
- lib/aerospike/query/pred_exp/regex_flags.rb
|
178
|
-
- lib/aerospike/query/pred_exp/string_value.rb
|
179
182
|
- lib/aerospike/query/query_command.rb
|
180
183
|
- lib/aerospike/query/query_executor.rb
|
181
184
|
- lib/aerospike/query/query_partition_command.rb
|
@@ -230,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
233
|
- !ruby/object:Gem::Version
|
231
234
|
version: '0'
|
232
235
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.5.11
|
234
237
|
signing_key:
|
235
238
|
specification_version: 4
|
236
239
|
summary: An Aerospike driver for Ruby.
|
@@ -1,105 +0,0 @@
|
|
1
|
-
# Copyright 2014-2020 Aerospike, Inc.
|
2
|
-
#
|
3
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
|
-
# license agreements.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
7
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
8
|
-
# the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
14
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
15
|
-
# License for the specific language governing permissions and limitations under
|
16
|
-
# the License.
|
17
|
-
|
18
|
-
require 'aerospike/command/multi_command'
|
19
|
-
|
20
|
-
module Aerospike
|
21
|
-
|
22
|
-
class BatchDirectCommand < MultiCommand #:nodoc:
|
23
|
-
|
24
|
-
attr_accessor :batch
|
25
|
-
attr_accessor :policy
|
26
|
-
attr_accessor :key_map
|
27
|
-
attr_accessor :bin_names
|
28
|
-
attr_accessor :results
|
29
|
-
attr_accessor :read_attr
|
30
|
-
|
31
|
-
def initialize(node, batch, policy, key_map, bin_names, results, read_attr)
|
32
|
-
super(node)
|
33
|
-
|
34
|
-
@batch = batch
|
35
|
-
@policy = policy
|
36
|
-
@key_map = key_map
|
37
|
-
@bin_names = bin_names
|
38
|
-
@results = results
|
39
|
-
@read_attr = read_attr
|
40
|
-
end
|
41
|
-
|
42
|
-
def write_buffer
|
43
|
-
# Estimate buffer size
|
44
|
-
begin_cmd
|
45
|
-
byte_size = batch.keys.length * DIGEST_SIZE
|
46
|
-
|
47
|
-
@data_offset += batch.namespace.bytesize +
|
48
|
-
FIELD_HEADER_SIZE + byte_size + FIELD_HEADER_SIZE
|
49
|
-
|
50
|
-
if bin_names
|
51
|
-
bin_names.each do |bin_name|
|
52
|
-
estimate_operation_size_for_bin_name(bin_name)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
size_buffer
|
57
|
-
|
58
|
-
operation_count = 0
|
59
|
-
if bin_names
|
60
|
-
operation_count = bin_names.length
|
61
|
-
end
|
62
|
-
|
63
|
-
write_header_read(policy, read_attr, 0, 2, operation_count)
|
64
|
-
write_field_string(batch.namespace, Aerospike::FieldType::NAMESPACE)
|
65
|
-
write_field_header(byte_size, Aerospike::FieldType::DIGEST_RIPE_ARRAY)
|
66
|
-
|
67
|
-
batch.keys.each do |key|
|
68
|
-
@data_offset += @data_buffer.write_binary(key.digest, @data_offset)
|
69
|
-
end
|
70
|
-
|
71
|
-
if bin_names
|
72
|
-
bin_names.each do |bin_name|
|
73
|
-
write_operation_for_bin_name(bin_name, Aerospike::Operation::READ)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end_cmd
|
78
|
-
mark_compressed(@policy)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Parse all results in the batch. Add records to shared list.
|
82
|
-
# If the record was not found, the bins will be nil.
|
83
|
-
def parse_row(result_code)
|
84
|
-
generation = @data_buffer.read_int32(6)
|
85
|
-
expiration = @data_buffer.read_int32(10)
|
86
|
-
field_count = @data_buffer.read_int16(18)
|
87
|
-
op_count = @data_buffer.read_int16(20)
|
88
|
-
|
89
|
-
key = parse_key(field_count)
|
90
|
-
|
91
|
-
item = key_map[key.digest]
|
92
|
-
if item
|
93
|
-
if result_code == 0
|
94
|
-
index = item.index
|
95
|
-
key = item.key
|
96
|
-
results[index] = parse_record(key, op_count, generation, expiration)
|
97
|
-
end
|
98
|
-
else
|
99
|
-
Aerospike.logger.warn("Unexpected batch key returned: #{key}")
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
end # class
|
104
|
-
|
105
|
-
end # module
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# Copyright 2014-2020 Aerospike, Inc.
|
2
|
-
#
|
3
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
|
-
# license agreements.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
7
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
8
|
-
# the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
14
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
15
|
-
# License for the specific language governing permissions and limitations under
|
16
|
-
# the License.
|
17
|
-
|
18
|
-
require 'aerospike/command/batch_direct_command'
|
19
|
-
|
20
|
-
module Aerospike
|
21
|
-
|
22
|
-
class BatchDirectExistsCommand < BatchDirectCommand #:nodoc:
|
23
|
-
|
24
|
-
def initialize(node, batch, policy, key_map, results)
|
25
|
-
super(node, batch, policy, key_map, nil, results, INFO1_READ | INFO1_NOBINDATA)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Parse all results in the batch. Add records to shared list.
|
29
|
-
# If the record was not found, the bins will be nil.
|
30
|
-
def parse_row(result_code)
|
31
|
-
field_count = @data_buffer.read_int16(18)
|
32
|
-
op_count = @data_buffer.read_int16(20)
|
33
|
-
|
34
|
-
if op_count > 0
|
35
|
-
raise Aerospike::Exceptions::Parse.new('Received bins that were not requested!')
|
36
|
-
end
|
37
|
-
|
38
|
-
key = parse_key(field_count)
|
39
|
-
item = key_map[key.digest]
|
40
|
-
|
41
|
-
if item
|
42
|
-
index = item.index
|
43
|
-
results[index] = (result_code == 0)
|
44
|
-
else
|
45
|
-
Aerospike::logger.debug("Unexpected batch key returned: #{key.namespace}, #{key.digest}")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end # class
|
50
|
-
|
51
|
-
end # module
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# Copyright 2014-2020 Aerospike, Inc.
|
2
|
-
#
|
3
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
|
-
# license agreements.
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
7
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
8
|
-
# the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
14
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
15
|
-
# License for the specific language governing permissions and limitations under
|
16
|
-
# the License.
|
17
|
-
|
18
|
-
module Aerospike
|
19
|
-
|
20
|
-
BatchNamespace = Struct.new :namespace, :keys
|
21
|
-
|
22
|
-
class BatchDirectNode #:nodoc:
|
23
|
-
|
24
|
-
attr_accessor :node
|
25
|
-
attr_accessor :batch_namespaces
|
26
|
-
|
27
|
-
def self.generate_list(cluster, replica_policy, keys)
|
28
|
-
keys.group_by { |key| cluster.get_node_for_key(replica_policy, key) }
|
29
|
-
.map { |node, keys_for_node| BatchDirectNode.new(node, keys_for_node) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def initialize(node, keys)
|
33
|
-
@node = node
|
34
|
-
@batch_namespaces = keys.group_by(&:namespace)
|
35
|
-
.map { |ns, keys_for_ns| BatchNamespace.new(ns, keys_for_ns) }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
class AndOr < PredExp
|
6
|
-
def initialize(op, nexp)
|
7
|
-
@op = op
|
8
|
-
@nexp = nexp
|
9
|
-
end
|
10
|
-
|
11
|
-
def estimate_size
|
12
|
-
8
|
13
|
-
end
|
14
|
-
|
15
|
-
def write(buffer, offset)
|
16
|
-
# write type
|
17
|
-
buffer.write_int16(@op, offset)
|
18
|
-
offset += 2
|
19
|
-
|
20
|
-
# write length
|
21
|
-
buffer.write_int32(2, offset)
|
22
|
-
offset += 4
|
23
|
-
|
24
|
-
# write predicate count
|
25
|
-
buffer.write_int16(@nexp, offset)
|
26
|
-
offset += 2
|
27
|
-
|
28
|
-
offset
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
class GeoJsonValue < PredExp
|
6
|
-
def initialize(value, type)
|
7
|
-
@value = value
|
8
|
-
@type = type
|
9
|
-
end
|
10
|
-
|
11
|
-
def estimate_size
|
12
|
-
@value.bytesize + 9
|
13
|
-
end
|
14
|
-
|
15
|
-
def write(buffer, offset)
|
16
|
-
# tag
|
17
|
-
buffer.write_uint16(@type, offset)
|
18
|
-
offset += 2
|
19
|
-
|
20
|
-
# len
|
21
|
-
buffer.write_uint32(@value.bytesize + 3, offset)
|
22
|
-
offset += 4
|
23
|
-
|
24
|
-
# flags
|
25
|
-
|
26
|
-
buffer.write_byte(0, offset)
|
27
|
-
offset += 1
|
28
|
-
|
29
|
-
# ncells
|
30
|
-
buffer.write_uint16(0, offset)
|
31
|
-
offset += 2
|
32
|
-
|
33
|
-
# value
|
34
|
-
len = buffer.write_binary(@value, offset)
|
35
|
-
offset += len
|
36
|
-
|
37
|
-
offset
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
class IntegerValue < PredExp
|
6
|
-
def initialize(value, type)
|
7
|
-
@value = value
|
8
|
-
@type = type
|
9
|
-
end
|
10
|
-
|
11
|
-
def estimate_size
|
12
|
-
14
|
13
|
-
end
|
14
|
-
|
15
|
-
def write(buffer, offset)
|
16
|
-
# Write type
|
17
|
-
buffer.write_int16(@type, offset)
|
18
|
-
offset += 2
|
19
|
-
|
20
|
-
# Write length
|
21
|
-
buffer.write_int32(8, offset)
|
22
|
-
offset += 4
|
23
|
-
|
24
|
-
# Write value.
|
25
|
-
buffer.write_int64(@value, offset)
|
26
|
-
offset += 8
|
27
|
-
|
28
|
-
offset
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
class Op < PredExp
|
6
|
-
def initialize(op)
|
7
|
-
@op = op
|
8
|
-
end
|
9
|
-
|
10
|
-
def estimate_size
|
11
|
-
6
|
12
|
-
end
|
13
|
-
|
14
|
-
def write(buffer, offset)
|
15
|
-
# write type
|
16
|
-
buffer.write_int16(@op, offset)
|
17
|
-
offset += 2
|
18
|
-
|
19
|
-
# write zero length
|
20
|
-
buffer.write_int32(0, offset)
|
21
|
-
offset += 4
|
22
|
-
|
23
|
-
offset
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
class Regex < PredExp
|
6
|
-
def initialize(op, flag = Flags::NONE)
|
7
|
-
@op = op
|
8
|
-
@flag = flag
|
9
|
-
end
|
10
|
-
|
11
|
-
def estimate_size
|
12
|
-
10
|
13
|
-
end
|
14
|
-
|
15
|
-
def write(buffer, offset)
|
16
|
-
# write op type
|
17
|
-
buffer.write_int16(@op, offset)
|
18
|
-
offset += 2
|
19
|
-
|
20
|
-
# write length
|
21
|
-
buffer.write_int32(4, offset)
|
22
|
-
offset += 4
|
23
|
-
|
24
|
-
# write predicate count
|
25
|
-
buffer.write_int32(@flag, offset)
|
26
|
-
offset += 4
|
27
|
-
|
28
|
-
offset
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# fr# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aerospike
|
4
|
-
class PredExp
|
5
|
-
# Regex bit flags
|
6
|
-
module RegexFlags
|
7
|
-
# Regex defaults
|
8
|
-
NONE = 0
|
9
|
-
|
10
|
-
# Use POSIX Extended Regular Expression syntax when interpreting regex.
|
11
|
-
EXTENDED = 1
|
12
|
-
|
13
|
-
# Do not differentiate case.
|
14
|
-
ICASE = 2
|
15
|
-
|
16
|
-
# Do not report position of matches.
|
17
|
-
NOSUB = 4
|
18
|
-
|
19
|
-
# Match-any-character operators don't match a newline.
|
20
|
-
NEWLINE = 8
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|