aerospike 2.9.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -4
- data/README.md +1 -1
- data/lib/aerospike.rb +12 -4
- data/lib/aerospike/aerospike_exception.rb +7 -1
- data/lib/aerospike/atomic/atomic.rb +1 -1
- data/lib/aerospike/bin.rb +1 -1
- data/lib/aerospike/cdt/list_operation.rb +1 -1
- data/lib/aerospike/cdt/map_operation.rb +1 -1
- data/lib/aerospike/cdt/map_order.rb +1 -1
- data/lib/aerospike/cdt/map_policy.rb +1 -1
- data/lib/aerospike/cdt/map_return_type.rb +1 -1
- data/lib/aerospike/cdt/map_write_mode.rb +1 -1
- data/lib/aerospike/client.rb +10 -11
- data/lib/aerospike/cluster.rb +92 -17
- data/lib/aerospike/cluster/partition.rb +1 -1
- data/lib/aerospike/cluster/partition_parser.rb +169 -0
- data/lib/aerospike/command/admin_command.rb +2 -3
- data/lib/aerospike/command/batch_direct_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_exists_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_node.rb +3 -3
- data/lib/aerospike/command/batch_index_command.rb +10 -2
- data/lib/aerospike/command/batch_index_node.rb +2 -2
- data/lib/aerospike/command/batch_item.rb +1 -1
- data/lib/aerospike/command/command.rb +102 -11
- data/lib/aerospike/command/delete_command.rb +21 -5
- data/lib/aerospike/command/execute_command.rb +1 -1
- data/lib/aerospike/command/exists_command.rb +21 -5
- data/lib/aerospike/command/field_type.rb +3 -1
- data/lib/aerospike/command/multi_command.rb +11 -4
- data/lib/aerospike/command/operate_command.rb +6 -1
- data/lib/aerospike/command/read_command.rb +29 -18
- data/lib/aerospike/command/read_header_command.rb +18 -6
- data/lib/aerospike/command/roles.rb +1 -1
- data/lib/aerospike/command/single_command.rb +9 -3
- data/lib/aerospike/command/touch_command.rb +14 -3
- data/lib/aerospike/command/unsupported_particle_type_validator.rb +1 -1
- data/lib/aerospike/command/write_command.rb +13 -4
- data/lib/aerospike/connection/create.rb +1 -1
- data/lib/aerospike/features.rb +1 -1
- data/lib/aerospike/geo_json.rb +70 -1
- data/lib/aerospike/host.rb +1 -1
- data/lib/aerospike/info.rb +1 -1
- data/lib/aerospike/key.rb +1 -1
- data/lib/aerospike/language.rb +1 -1
- data/lib/aerospike/node.rb +3 -6
- data/lib/aerospike/node/refresh/partitions.rb +6 -15
- data/lib/aerospike/node_validator.rb +45 -40
- data/lib/aerospike/operation.rb +6 -1
- data/lib/aerospike/policy/admin_policy.rb +1 -1
- data/lib/aerospike/policy/batch_policy.rb +1 -1
- data/lib/aerospike/policy/client_policy.rb +1 -1
- data/lib/aerospike/policy/commit_level.rb +1 -1
- data/lib/aerospike/policy/consistency_level.rb +1 -1
- data/lib/aerospike/policy/generation_policy.rb +1 -1
- data/lib/aerospike/policy/operate_policy.rb +1 -1
- data/lib/aerospike/policy/policy.rb +57 -3
- data/lib/aerospike/policy/priority.rb +1 -1
- data/lib/aerospike/policy/query_policy.rb +8 -1
- data/lib/aerospike/policy/record_bin_multiplicity.rb +1 -1
- data/lib/aerospike/policy/record_exists_action.rb +1 -1
- data/lib/aerospike/policy/replica.rb +38 -0
- data/lib/aerospike/policy/scan_policy.rb +8 -1
- data/lib/aerospike/policy/write_policy.rb +1 -1
- data/lib/aerospike/query/filter.rb +1 -1
- data/lib/aerospike/query/pred_exp.rb +192 -0
- data/lib/aerospike/query/pred_exp/and_or.rb +32 -0
- data/lib/aerospike/query/pred_exp/geo_json_value.rb +41 -0
- data/lib/aerospike/query/pred_exp/integer_value.rb +32 -0
- data/lib/aerospike/query/pred_exp/op.rb +27 -0
- data/lib/aerospike/query/pred_exp/regex.rb +32 -0
- data/lib/aerospike/query/pred_exp/regex_flags.rb +23 -0
- data/lib/aerospike/query/pred_exp/string_value.rb +29 -0
- data/lib/aerospike/query/query_command.rb +27 -1
- data/lib/aerospike/query/recordset.rb +5 -5
- data/lib/aerospike/query/scan_command.rb +1 -1
- data/lib/aerospike/query/statement.rb +12 -3
- data/lib/aerospike/query/stream_command.rb +9 -10
- data/lib/aerospike/record.rb +1 -1
- data/lib/aerospike/result_code.rb +13 -20
- data/lib/aerospike/socket/base.rb +1 -1
- data/lib/aerospike/task/execute_task.rb +1 -1
- data/lib/aerospike/task/index_task.rb +1 -1
- data/lib/aerospike/task/task.rb +1 -1
- data/lib/aerospike/task/udf_register_task.rb +1 -1
- data/lib/aerospike/task/udf_remove_task.rb +1 -1
- data/lib/aerospike/ttl.rb +1 -1
- data/lib/aerospike/udf.rb +1 -1
- data/lib/aerospike/user_role.rb +1 -1
- data/lib/aerospike/utils/buffer.rb +1 -1
- data/lib/aerospike/utils/packer.rb +1 -1
- data/lib/aerospike/utils/pool.rb +1 -1
- data/lib/aerospike/utils/unpacker.rb +7 -2
- data/lib/aerospike/value/particle_type.rb +1 -1
- data/lib/aerospike/value/value.rb +59 -29
- data/lib/aerospike/version.rb +1 -1
- metadata +15 -8
- data/lib/aerospike/cluster/partition_tokenizer_new.rb +0 -130
- data/lib/aerospike/cluster/partition_tokenizer_old.rb +0 -135
data/lib/aerospike/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aerospike
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khosrow Afroozeh
|
8
8
|
- Jan Hecking
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -73,8 +73,7 @@ files:
|
|
73
73
|
- lib/aerospike/cluster/find_node.rb
|
74
74
|
- lib/aerospike/cluster/find_nodes_to_remove.rb
|
75
75
|
- lib/aerospike/cluster/partition.rb
|
76
|
-
- lib/aerospike/cluster/
|
77
|
-
- lib/aerospike/cluster/partition_tokenizer_old.rb
|
76
|
+
- lib/aerospike/cluster/partition_parser.rb
|
78
77
|
- lib/aerospike/command/admin_command.rb
|
79
78
|
- lib/aerospike/command/batch_direct_command.rb
|
80
79
|
- lib/aerospike/command/batch_direct_exists_command.rb
|
@@ -137,9 +136,18 @@ files:
|
|
137
136
|
- lib/aerospike/policy/query_policy.rb
|
138
137
|
- lib/aerospike/policy/record_bin_multiplicity.rb
|
139
138
|
- lib/aerospike/policy/record_exists_action.rb
|
139
|
+
- lib/aerospike/policy/replica.rb
|
140
140
|
- lib/aerospike/policy/scan_policy.rb
|
141
141
|
- lib/aerospike/policy/write_policy.rb
|
142
142
|
- lib/aerospike/query/filter.rb
|
143
|
+
- lib/aerospike/query/pred_exp.rb
|
144
|
+
- lib/aerospike/query/pred_exp/and_or.rb
|
145
|
+
- lib/aerospike/query/pred_exp/geo_json_value.rb
|
146
|
+
- lib/aerospike/query/pred_exp/integer_value.rb
|
147
|
+
- lib/aerospike/query/pred_exp/op.rb
|
148
|
+
- lib/aerospike/query/pred_exp/regex.rb
|
149
|
+
- lib/aerospike/query/pred_exp/regex_flags.rb
|
150
|
+
- lib/aerospike/query/pred_exp/string_value.rb
|
143
151
|
- lib/aerospike/query/query_command.rb
|
144
152
|
- lib/aerospike/query/recordset.rb
|
145
153
|
- lib/aerospike/query/scan_command.rb
|
@@ -188,9 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
196
|
- !ruby/object:Gem::Version
|
189
197
|
version: '0'
|
190
198
|
requirements: []
|
191
|
-
|
192
|
-
|
193
|
-
signing_key:
|
199
|
+
rubygems_version: 3.1.2
|
200
|
+
signing_key:
|
194
201
|
specification_version: 4
|
195
202
|
summary: An Aerospike driver for Ruby.
|
196
203
|
test_files: []
|
@@ -1,130 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
require 'base64'
|
18
|
-
|
19
|
-
module Aerospike
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
REPLICAS_NAME = 'replicas-master'
|
24
|
-
|
25
|
-
class PartitionTokenizerNew #:nodoc:
|
26
|
-
|
27
|
-
def initialize(conn)
|
28
|
-
# Use low-level info methods and parse byte array directly for maximum performance.
|
29
|
-
# Send format: replicas-master\n
|
30
|
-
# Receive format: replicas-master\t<ns1>:<base 64 encoded bitmap>;<ns2>:<base 64 encoded bitmap>... \n
|
31
|
-
info_map = Info.request(conn, REPLICAS_NAME)
|
32
|
-
|
33
|
-
info = info_map[REPLICAS_NAME]
|
34
|
-
|
35
|
-
@length = info ? info.length : 0
|
36
|
-
|
37
|
-
if !info || @length == 0
|
38
|
-
raise Aerospike::Exceptions::Connection.new("#{replicas_name} is empty")
|
39
|
-
end
|
40
|
-
|
41
|
-
@buffer = info
|
42
|
-
@offset = 0
|
43
|
-
|
44
|
-
self
|
45
|
-
end
|
46
|
-
|
47
|
-
def update_partition(nmap, node)
|
48
|
-
amap = nil
|
49
|
-
|
50
|
-
beginning = @offset
|
51
|
-
copied = false
|
52
|
-
|
53
|
-
while @offset < @length
|
54
|
-
if @buffer[@offset] == ':'
|
55
|
-
# Parse namespace.
|
56
|
-
namespace = @buffer[beginning...@offset].strip
|
57
|
-
|
58
|
-
if namespace.length <= 0 || namespace.length >= 32
|
59
|
-
response = get_truncated_response
|
60
|
-
raise Aerospike::Exceptions::Parse.new(
|
61
|
-
"Invalid partition namespace #{namespace}. Response=#{response}"
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
|
-
@offset+=1
|
66
|
-
beginning = @offset
|
67
|
-
|
68
|
-
# Parse partition id.
|
69
|
-
while @offset < @length
|
70
|
-
b = @buffer[@offset]
|
71
|
-
|
72
|
-
break if b == ';' || b == "\n"
|
73
|
-
@offset+=1
|
74
|
-
end
|
75
|
-
|
76
|
-
if @offset == beginning
|
77
|
-
response = get_truncated_response
|
78
|
-
|
79
|
-
raise Aerospike::Exceptions::Parse.new(
|
80
|
-
"Empty partition id for namespace #{namespace}. Response=#{response}"
|
81
|
-
)
|
82
|
-
end
|
83
|
-
|
84
|
-
node_array = nmap[namespace]
|
85
|
-
|
86
|
-
if !node_array
|
87
|
-
if !copied
|
88
|
-
# Make shallow copy of map.
|
89
|
-
amap = {}
|
90
|
-
nmap.each {|k, v| amap[k] = Atomic.new(v)}
|
91
|
-
copied = true
|
92
|
-
end
|
93
|
-
|
94
|
-
node_array = Atomic.new(Array.new(Aerospike::Node::PARTITIONS))
|
95
|
-
amap[namespace] = node_array
|
96
|
-
end
|
97
|
-
|
98
|
-
bit_map_length = @offset - beginning
|
99
|
-
restore_buffer = Base64.strict_decode64(@buffer[beginning, bit_map_length])
|
100
|
-
i = 0
|
101
|
-
while i < Aerospike::Node::PARTITIONS
|
102
|
-
if (restore_buffer[i>>3].ord & (0x80 >> (i & 7))) != 0
|
103
|
-
# Logger.Info("Map: `" + namespace + "`," + strconv.Itoa(i) + "," + node.String)
|
104
|
-
node_array.update{|v| v[i] = node; v}
|
105
|
-
end
|
106
|
-
i = i.succ
|
107
|
-
end
|
108
|
-
|
109
|
-
@offset+=1
|
110
|
-
beginning = @offset
|
111
|
-
else
|
112
|
-
@offset+=1
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
copied ? amap : nil
|
117
|
-
end
|
118
|
-
|
119
|
-
private
|
120
|
-
|
121
|
-
def get_truncated_response
|
122
|
-
max = @length
|
123
|
-
@length = max if @length > 200
|
124
|
-
@buffer[0...max]
|
125
|
-
end
|
126
|
-
|
127
|
-
|
128
|
-
end # class
|
129
|
-
|
130
|
-
end # module
|
@@ -1,135 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright 2014-2017 Aerospike, Inc.
|
3
|
-
#
|
4
|
-
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
5
|
-
# license agreements.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
8
|
-
# use this file except in compliance with the License. You may obtain a copy of
|
9
|
-
# the License at http:#www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
-
# License for the specific language governing permissions and limitations under
|
15
|
-
# the License.
|
16
|
-
|
17
|
-
require 'base64'
|
18
|
-
|
19
|
-
module Aerospike
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
class PartitionTokenizerOld #:nodoc:
|
24
|
-
|
25
|
-
def initialize(conn)
|
26
|
-
# Use low-level info methods and parse byte array directly for maximum performance.
|
27
|
-
# Send format: replicas-master\n
|
28
|
-
# Receive format: replicas-master\t<ns1>:<base 64 encoded bitmap>;<ns2>:<base 64 encoded bitmap>... \n
|
29
|
-
info_map = Info.request(conn, REPLICAS_NAME)
|
30
|
-
|
31
|
-
info = info_map[REPLICAS_NAME]
|
32
|
-
|
33
|
-
@length = info ? info.length : 0
|
34
|
-
|
35
|
-
if !info || @length == 0
|
36
|
-
raise Aerospike::Exceptions::Connection.new("#{replicas_name} is empty")
|
37
|
-
end
|
38
|
-
|
39
|
-
@buffer = info
|
40
|
-
@offset = 0
|
41
|
-
|
42
|
-
self
|
43
|
-
end
|
44
|
-
|
45
|
-
def update_partition(nmap, node)
|
46
|
-
amap = nil
|
47
|
-
copied = false
|
48
|
-
|
49
|
-
while partition = get_next
|
50
|
-
node_array = nmap[partition.namespace]
|
51
|
-
|
52
|
-
if !node_array
|
53
|
-
if !copied
|
54
|
-
# Make shallow copy of map.
|
55
|
-
amap = {}
|
56
|
-
nmap.each {|k, v| amap[k] = v}
|
57
|
-
copied = true
|
58
|
-
end
|
59
|
-
|
60
|
-
node_array = Atomic.new(Array.new(Aerospike::Node::PARTITIONS))
|
61
|
-
amap[partition.namespace] = node_array
|
62
|
-
end
|
63
|
-
|
64
|
-
Aerospike.logger.debug("#{partition.to_s}, #{node.name}")
|
65
|
-
node_array.update{|v| v[partition.partition_id] = node; v }
|
66
|
-
end
|
67
|
-
|
68
|
-
copied ? amap : nil
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
def get_next
|
74
|
-
beginning = @offset
|
75
|
-
|
76
|
-
while @offset < @length
|
77
|
-
if @buffer[@offset] == ':'
|
78
|
-
# Parse namespace.
|
79
|
-
namespace = @buffer[beginning...@offset].strip
|
80
|
-
|
81
|
-
if namespace.length <= 0 || namespace.length >= 32
|
82
|
-
response = get_truncated_response
|
83
|
-
raise Aerospike::Exceptions::Parse.new(
|
84
|
-
"Invalid partition namespace #{namespace}. Response=#{response}"
|
85
|
-
)
|
86
|
-
end
|
87
|
-
|
88
|
-
@offset+=1
|
89
|
-
beginning = @offset
|
90
|
-
|
91
|
-
# Parse partition id.
|
92
|
-
while @offset < @length
|
93
|
-
b = @buffer[@offset]
|
94
|
-
|
95
|
-
break if b == ';' || b == "\n"
|
96
|
-
@offset+=1
|
97
|
-
end
|
98
|
-
|
99
|
-
if @offset == beginning
|
100
|
-
response = get_truncated_response
|
101
|
-
raise Aerospike::Exceptions::Parse.new(
|
102
|
-
"Empty partition id for namespace #{namespace}. Response=#{response}"
|
103
|
-
)
|
104
|
-
end
|
105
|
-
|
106
|
-
partition_id = @buffer[beginning...@offset].to_i
|
107
|
-
if partition_id < 0 || partition_id >= Aerospike::Node::PARTITIONS
|
108
|
-
response = get_truncated_response
|
109
|
-
partition_string = @buffer[beginning...@offset]
|
110
|
-
raise Aerospike::Exceptions::Parse.new(
|
111
|
-
"Invalid partition id #{partition_string} for namespace #{namespace}. Response=#{response}"
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
@offset+=1
|
116
|
-
beginning = @offset
|
117
|
-
|
118
|
-
return Partition.new(namespace, partition_id)
|
119
|
-
end
|
120
|
-
@offset+=1
|
121
|
-
end
|
122
|
-
return nil
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
def get_truncated_response
|
127
|
-
max = @length
|
128
|
-
@length = max if @length > 200
|
129
|
-
@buffer[0...max]
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
end # class
|
134
|
-
|
135
|
-
end # module
|