aerospike 2.10.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -1
  3. data/README.md +1 -1
  4. data/lib/aerospike.rb +20 -4
  5. data/lib/aerospike/aerospike_exception.rb +7 -1
  6. data/lib/aerospike/atomic/atomic.rb +1 -1
  7. data/lib/aerospike/bin.rb +1 -1
  8. data/lib/aerospike/cdt/hll_operation.rb +200 -0
  9. data/lib/aerospike/cdt/hll_policy.rb +34 -0
  10. data/lib/aerospike/cdt/hll_write_flags.rb +53 -0
  11. data/lib/aerospike/cdt/list_operation.rb +1 -1
  12. data/lib/aerospike/cdt/map_operation.rb +1 -1
  13. data/lib/aerospike/cdt/map_order.rb +1 -1
  14. data/lib/aerospike/cdt/map_policy.rb +1 -1
  15. data/lib/aerospike/cdt/map_return_type.rb +1 -1
  16. data/lib/aerospike/cdt/map_write_mode.rb +1 -1
  17. data/lib/aerospike/client.rb +34 -18
  18. data/lib/aerospike/cluster.rb +139 -17
  19. data/lib/aerospike/cluster/partition.rb +1 -1
  20. data/lib/aerospike/cluster/partition_parser.rb +169 -0
  21. data/lib/aerospike/cluster/rack_parser.rb +117 -0
  22. data/lib/aerospike/command/admin_command.rb +1 -1
  23. data/lib/aerospike/command/batch_direct_command.rb +2 -1
  24. data/lib/aerospike/command/batch_direct_exists_command.rb +1 -1
  25. data/lib/aerospike/command/batch_direct_node.rb +3 -3
  26. data/lib/aerospike/command/batch_index_command.rb +11 -2
  27. data/lib/aerospike/command/batch_index_node.rb +2 -2
  28. data/lib/aerospike/command/batch_item.rb +1 -1
  29. data/lib/aerospike/command/command.rb +168 -11
  30. data/lib/aerospike/command/delete_command.rb +21 -5
  31. data/lib/aerospike/command/execute_command.rb +1 -1
  32. data/lib/aerospike/command/exists_command.rb +21 -5
  33. data/lib/aerospike/command/field_type.rb +3 -1
  34. data/lib/aerospike/command/multi_command.rb +55 -5
  35. data/lib/aerospike/command/operate_command.rb +6 -1
  36. data/lib/aerospike/command/read_command.rb +63 -20
  37. data/lib/aerospike/command/read_header_command.rb +18 -6
  38. data/lib/aerospike/command/roles.rb +1 -1
  39. data/lib/aerospike/command/single_command.rb +9 -3
  40. data/lib/aerospike/command/touch_command.rb +48 -4
  41. data/lib/aerospike/command/unsupported_particle_type_validator.rb +1 -1
  42. data/lib/aerospike/command/write_command.rb +13 -4
  43. data/lib/aerospike/connection/create.rb +1 -1
  44. data/lib/aerospike/features.rb +3 -1
  45. data/lib/aerospike/geo_json.rb +70 -1
  46. data/lib/aerospike/host.rb +1 -1
  47. data/lib/aerospike/info.rb +1 -1
  48. data/lib/aerospike/key.rb +1 -1
  49. data/lib/aerospike/language.rb +1 -1
  50. data/lib/aerospike/node.rb +21 -7
  51. data/lib/aerospike/node/rebalance.rb +50 -0
  52. data/lib/aerospike/node/refresh/info.rb +4 -1
  53. data/lib/aerospike/node/refresh/partitions.rb +6 -15
  54. data/lib/aerospike/node/refresh/racks.rb +47 -0
  55. data/lib/aerospike/node/refresh/reset.rb +1 -0
  56. data/lib/aerospike/node/verify/rebalance_generation.rb +43 -0
  57. data/lib/aerospike/node_validator.rb +4 -19
  58. data/lib/aerospike/operation.rb +8 -1
  59. data/lib/aerospike/policy/admin_policy.rb +1 -1
  60. data/lib/aerospike/policy/batch_policy.rb +1 -1
  61. data/lib/aerospike/policy/client_policy.rb +16 -1
  62. data/lib/aerospike/policy/commit_level.rb +1 -1
  63. data/lib/aerospike/policy/consistency_level.rb +1 -1
  64. data/lib/aerospike/policy/generation_policy.rb +1 -1
  65. data/lib/aerospike/policy/operate_policy.rb +1 -1
  66. data/lib/aerospike/policy/policy.rb +64 -2
  67. data/lib/aerospike/policy/priority.rb +1 -1
  68. data/lib/aerospike/policy/query_policy.rb +8 -1
  69. data/lib/aerospike/policy/record_bin_multiplicity.rb +1 -1
  70. data/lib/aerospike/policy/record_exists_action.rb +1 -1
  71. data/lib/aerospike/policy/replica.rb +45 -0
  72. data/lib/aerospike/policy/scan_policy.rb +8 -1
  73. data/lib/aerospike/policy/write_policy.rb +1 -1
  74. data/lib/aerospike/query/filter.rb +1 -1
  75. data/lib/aerospike/query/pred_exp.rb +192 -0
  76. data/lib/aerospike/query/pred_exp/and_or.rb +32 -0
  77. data/lib/aerospike/query/pred_exp/geo_json_value.rb +41 -0
  78. data/lib/aerospike/query/pred_exp/integer_value.rb +32 -0
  79. data/lib/aerospike/query/pred_exp/op.rb +27 -0
  80. data/lib/aerospike/query/pred_exp/regex.rb +32 -0
  81. data/lib/aerospike/query/pred_exp/regex_flags.rb +23 -0
  82. data/lib/aerospike/query/pred_exp/string_value.rb +29 -0
  83. data/lib/aerospike/query/query_command.rb +27 -1
  84. data/lib/aerospike/query/recordset.rb +5 -5
  85. data/lib/aerospike/query/scan_command.rb +1 -1
  86. data/lib/aerospike/query/statement.rb +12 -3
  87. data/lib/aerospike/query/stream_command.rb +1 -1
  88. data/lib/aerospike/record.rb +1 -1
  89. data/lib/aerospike/result_code.rb +26 -7
  90. data/lib/aerospike/socket/base.rb +4 -3
  91. data/lib/aerospike/task/execute_task.rb +1 -1
  92. data/lib/aerospike/task/index_task.rb +1 -1
  93. data/lib/aerospike/task/task.rb +1 -1
  94. data/lib/aerospike/task/udf_register_task.rb +1 -1
  95. data/lib/aerospike/task/udf_remove_task.rb +1 -1
  96. data/lib/aerospike/ttl.rb +1 -1
  97. data/lib/aerospike/udf.rb +1 -1
  98. data/lib/aerospike/user_role.rb +1 -1
  99. data/lib/aerospike/utils/buffer.rb +14 -4
  100. data/lib/aerospike/utils/packer.rb +1 -1
  101. data/lib/aerospike/utils/pool.rb +1 -1
  102. data/lib/aerospike/utils/unpacker.rb +7 -2
  103. data/lib/aerospike/value/particle_type.rb +2 -2
  104. data/lib/aerospike/value/value.rb +106 -29
  105. data/lib/aerospike/version.rb +1 -1
  106. metadata +22 -8
  107. data/lib/aerospike/cluster/partition_tokenizer_new.rb +0 -130
  108. data/lib/aerospike/cluster/partition_tokenizer_old.rb +0 -135
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.10.0"
3
+ VERSION = "2.15.0"
4
4
  end
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.10.0
4
+ version: 2.15.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: 2019-05-10 00:00:00.000000000 Z
12
+ date: 2020-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -55,6 +55,9 @@ files:
55
55
  - lib/aerospike/aerospike_exception.rb
56
56
  - lib/aerospike/atomic/atomic.rb
57
57
  - lib/aerospike/bin.rb
58
+ - lib/aerospike/cdt/hll_operation.rb
59
+ - lib/aerospike/cdt/hll_policy.rb
60
+ - lib/aerospike/cdt/hll_write_flags.rb
58
61
  - lib/aerospike/cdt/list_operation.rb
59
62
  - lib/aerospike/cdt/list_order.rb
60
63
  - lib/aerospike/cdt/list_policy.rb
@@ -73,8 +76,8 @@ files:
73
76
  - lib/aerospike/cluster/find_node.rb
74
77
  - lib/aerospike/cluster/find_nodes_to_remove.rb
75
78
  - lib/aerospike/cluster/partition.rb
76
- - lib/aerospike/cluster/partition_tokenizer_new.rb
77
- - lib/aerospike/cluster/partition_tokenizer_old.rb
79
+ - lib/aerospike/cluster/partition_parser.rb
80
+ - lib/aerospike/cluster/rack_parser.rb
78
81
  - lib/aerospike/command/admin_command.rb
79
82
  - lib/aerospike/command/batch_direct_command.rb
80
83
  - lib/aerospike/command/batch_direct_exists_command.rb
@@ -109,16 +112,19 @@ files:
109
112
  - lib/aerospike/loggable.rb
110
113
  - lib/aerospike/node.rb
111
114
  - lib/aerospike/node/generation.rb
115
+ - lib/aerospike/node/rebalance.rb
112
116
  - lib/aerospike/node/refresh/failed.rb
113
117
  - lib/aerospike/node/refresh/friends.rb
114
118
  - lib/aerospike/node/refresh/info.rb
115
119
  - lib/aerospike/node/refresh/partitions.rb
116
120
  - lib/aerospike/node/refresh/peers.rb
121
+ - lib/aerospike/node/refresh/racks.rb
117
122
  - lib/aerospike/node/refresh/reset.rb
118
123
  - lib/aerospike/node/verify/cluster_name.rb
119
124
  - lib/aerospike/node/verify/name.rb
120
125
  - lib/aerospike/node/verify/partition_generation.rb
121
126
  - lib/aerospike/node/verify/peers_generation.rb
127
+ - lib/aerospike/node/verify/rebalance_generation.rb
122
128
  - lib/aerospike/node_validator.rb
123
129
  - lib/aerospike/operation.rb
124
130
  - lib/aerospike/peer.rb
@@ -137,9 +143,18 @@ files:
137
143
  - lib/aerospike/policy/query_policy.rb
138
144
  - lib/aerospike/policy/record_bin_multiplicity.rb
139
145
  - lib/aerospike/policy/record_exists_action.rb
146
+ - lib/aerospike/policy/replica.rb
140
147
  - lib/aerospike/policy/scan_policy.rb
141
148
  - lib/aerospike/policy/write_policy.rb
142
149
  - lib/aerospike/query/filter.rb
150
+ - lib/aerospike/query/pred_exp.rb
151
+ - lib/aerospike/query/pred_exp/and_or.rb
152
+ - lib/aerospike/query/pred_exp/geo_json_value.rb
153
+ - lib/aerospike/query/pred_exp/integer_value.rb
154
+ - lib/aerospike/query/pred_exp/op.rb
155
+ - lib/aerospike/query/pred_exp/regex.rb
156
+ - lib/aerospike/query/pred_exp/regex_flags.rb
157
+ - lib/aerospike/query/pred_exp/string_value.rb
143
158
  - lib/aerospike/query/query_command.rb
144
159
  - lib/aerospike/query/recordset.rb
145
160
  - lib/aerospike/query/scan_command.rb
@@ -188,9 +203,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
203
  - !ruby/object:Gem::Version
189
204
  version: '0'
190
205
  requirements: []
191
- rubyforge_project:
192
- rubygems_version: 2.7.9
193
- signing_key:
206
+ rubygems_version: 3.1.2
207
+ signing_key:
194
208
  specification_version: 4
195
209
  summary: An Aerospike driver for Ruby.
196
210
  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