aerospike 3.0.0 → 4.0.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +13 -9
  4. data/lib/aerospike/batch_attr.rb +292 -0
  5. data/lib/aerospike/batch_delete.rb +48 -0
  6. data/lib/aerospike/batch_read.rb +97 -0
  7. data/lib/aerospike/batch_record.rb +83 -0
  8. data/lib/aerospike/batch_results.rb +38 -0
  9. data/lib/aerospike/batch_udf.rb +76 -0
  10. data/lib/aerospike/batch_write.rb +79 -0
  11. data/lib/aerospike/cdt/bit_operation.rb +4 -5
  12. data/lib/aerospike/cdt/map_return_type.rb +8 -0
  13. data/lib/aerospike/client.rb +37 -51
  14. data/lib/aerospike/cluster.rb +50 -46
  15. data/lib/aerospike/command/batch_index_command.rb +6 -10
  16. data/lib/aerospike/command/batch_index_node.rb +3 -4
  17. data/lib/aerospike/command/batch_operate_command.rb +151 -0
  18. data/lib/aerospike/command/batch_operate_node.rb +51 -0
  19. data/lib/aerospike/command/command.rb +101 -87
  20. data/lib/aerospike/command/single_command.rb +1 -1
  21. data/lib/aerospike/exp/exp.rb +39 -41
  22. data/lib/aerospike/exp/exp_bit.rb +24 -24
  23. data/lib/aerospike/exp/exp_hll.rb +12 -12
  24. data/lib/aerospike/exp/exp_list.rb +101 -92
  25. data/lib/aerospike/exp/exp_map.rb +118 -121
  26. data/lib/aerospike/exp/operation.rb +2 -2
  27. data/lib/aerospike/info.rb +2 -4
  28. data/lib/aerospike/node.rb +7 -3
  29. data/lib/aerospike/operation.rb +38 -0
  30. data/lib/aerospike/policy/batch_delete_policy.rb +71 -0
  31. data/lib/aerospike/policy/batch_policy.rb +53 -4
  32. data/lib/aerospike/{command/batch_direct_node.rb → policy/batch_read_policy.rb} +17 -19
  33. data/lib/aerospike/policy/batch_udf_policy.rb +75 -0
  34. data/lib/aerospike/policy/batch_write_policy.rb +105 -0
  35. data/lib/aerospike/policy/policy.rb +3 -40
  36. data/lib/aerospike/query/server_command.rb +1 -0
  37. data/lib/aerospike/query/statement.rb +5 -21
  38. data/lib/aerospike/utils/buffer.rb +15 -15
  39. data/lib/aerospike/version.rb +1 -1
  40. data/lib/aerospike.rb +13 -12
  41. metadata +16 -14
  42. data/lib/aerospike/command/batch_direct_command.rb +0 -105
  43. data/lib/aerospike/command/batch_direct_exists_command.rb +0 -51
  44. data/lib/aerospike/query/pred_exp/and_or.rb +0 -32
  45. data/lib/aerospike/query/pred_exp/geo_json_value.rb +0 -41
  46. data/lib/aerospike/query/pred_exp/integer_value.rb +0 -32
  47. data/lib/aerospike/query/pred_exp/op.rb +0 -27
  48. data/lib/aerospike/query/pred_exp/regex.rb +0 -32
  49. data/lib/aerospike/query/pred_exp/regex_flags.rb +0 -23
  50. data/lib/aerospike/query/pred_exp/string_value.rb +0 -29
  51. data/lib/aerospike/query/pred_exp.rb +0 -192
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"
@@ -97,6 +96,10 @@ require "aerospike/policy/record_exists_action"
97
96
  require "aerospike/policy/generation_policy"
98
97
  require "aerospike/policy/policy"
99
98
  require "aerospike/policy/batch_policy"
99
+ require "aerospike/policy/batch_delete_policy"
100
+ require "aerospike/policy/batch_read_policy"
101
+ require "aerospike/policy/batch_udf_policy"
102
+ require "aerospike/policy/batch_write_policy"
100
103
  require "aerospike/policy/write_policy"
101
104
  require "aerospike/policy/scan_policy"
102
105
  require "aerospike/policy/query_policy"
@@ -105,6 +108,13 @@ require "aerospike/policy/commit_level"
105
108
  require "aerospike/policy/admin_policy"
106
109
  require "aerospike/policy/auth_mode"
107
110
 
111
+ require "aerospike/batch_record"
112
+ require "aerospike/batch_attr"
113
+ require "aerospike/batch_read"
114
+ require "aerospike/batch_write"
115
+ require "aerospike/batch_delete"
116
+ require "aerospike/batch_udf"
117
+
108
118
  require "aerospike/socket/base"
109
119
  require "aerospike/socket/ssl"
110
120
  require "aerospike/socket/tcp"
@@ -160,7 +170,6 @@ require "aerospike/query/stream_command"
160
170
  require "aerospike/query/query_command"
161
171
  require "aerospike/query/scan_command"
162
172
  require "aerospike/query/statement"
163
- require "aerospike/query/pred_exp"
164
173
  require "aerospike/query/partition_tracker"
165
174
  require "aerospike/query/partition_status"
166
175
  require "aerospike/query/partition_filter"
@@ -178,14 +187,6 @@ require "aerospike/exp/exp_bit"
178
187
  require "aerospike/exp/exp_hll"
179
188
  require "aerospike/exp/operation"
180
189
 
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
190
  module Aerospike
190
191
  extend Loggable
191
192
  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: 3.0.0
4
+ version: 4.0.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: 2023-12-18 00:00:00.000000000 Z
13
+ date: 2024-08-14 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
@@ -168,14 +178,6 @@ files:
168
178
  - lib/aerospike/query/partition_filter.rb
169
179
  - lib/aerospike/query/partition_status.rb
170
180
  - 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
181
  - lib/aerospike/query/query_command.rb
180
182
  - lib/aerospike/query/query_executor.rb
181
183
  - lib/aerospike/query/query_partition_command.rb
@@ -230,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
232
  - !ruby/object:Gem::Version
231
233
  version: '0'
232
234
  requirements: []
233
- rubygems_version: 3.3.3
235
+ rubygems_version: 3.5.11
234
236
  signing_key:
235
237
  specification_version: 4
236
238
  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,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
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aerospike
4
- class PredExp
5
- class StringValue < PredExp
6
- def initialize(value, type)
7
- @value = value
8
- @type = type
9
- end
10
-
11
- def estimate_size
12
- @value.bytesize + 6
13
- end
14
-
15
- def write(buffer, offset)
16
- buffer.write_int16(@type, offset)
17
- offset += 2
18
-
19
- buffer.write_int32(@value.bytesize, offset)
20
- offset += 4
21
-
22
- len = buffer.write_binary(@value, offset)
23
- offset += len
24
-
25
- offset
26
- end
27
- end
28
- end
29
- end