aerospike 2.21.1 → 2.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -1
  3. data/lib/aerospike/atomic/atomic.rb +1 -1
  4. data/lib/aerospike/cdt/context.rb +7 -7
  5. data/lib/aerospike/cdt/list_return_type.rb +4 -0
  6. data/lib/aerospike/cdt/map_operation.rb +6 -6
  7. data/lib/aerospike/cdt/map_return_type.rb +4 -0
  8. data/lib/aerospike/client.rb +34 -59
  9. data/lib/aerospike/cluster.rb +6 -3
  10. data/lib/aerospike/command/admin_command.rb +2 -2
  11. data/lib/aerospike/command/batch_index_node.rb +1 -1
  12. data/lib/aerospike/command/batch_item.rb +1 -1
  13. data/lib/aerospike/command/command.rb +62 -30
  14. data/lib/aerospike/command/field_type.rb +3 -0
  15. data/lib/aerospike/command/login_command.rb +7 -5
  16. data/lib/aerospike/command/multi_command.rb +8 -2
  17. data/lib/aerospike/command/read_command.rb +2 -2
  18. data/lib/aerospike/connection/authenticate.rb +4 -4
  19. data/lib/aerospike/features.rb +9 -9
  20. data/lib/aerospike/host/parse.rb +2 -2
  21. data/lib/aerospike/key.rb +10 -1
  22. data/lib/aerospike/node/refresh/info.rb +1 -1
  23. data/lib/aerospike/node/verify/name.rb +1 -1
  24. data/lib/aerospike/node/verify/partition_generation.rb +1 -1
  25. data/lib/aerospike/node/verify/peers_generation.rb +1 -1
  26. data/lib/aerospike/node/verify/rebalance_generation.rb +1 -1
  27. data/lib/aerospike/node_validator.rb +6 -1
  28. data/lib/aerospike/policy/policy.rb +4 -1
  29. data/lib/aerospike/policy/scan_policy.rb +20 -1
  30. data/lib/aerospike/privilege.rb +1 -1
  31. data/lib/aerospike/query/node_partitions.rb +39 -0
  32. data/lib/aerospike/query/partition_filter.rb +66 -0
  33. data/lib/aerospike/query/partition_status.rb +36 -0
  34. data/lib/aerospike/query/partition_tracker.rb +347 -0
  35. data/lib/aerospike/query/scan_command.rb +3 -3
  36. data/lib/aerospike/query/scan_executor.rb +69 -0
  37. data/lib/aerospike/query/scan_partition_command.rb +49 -0
  38. data/lib/aerospike/query/statement.rb +1 -1
  39. data/lib/aerospike/query/stream_command.rb +14 -1
  40. data/lib/aerospike/result_code.rb +79 -4
  41. data/lib/aerospike/role.rb +2 -2
  42. data/lib/aerospike/task/execute_task.rb +2 -2
  43. data/lib/aerospike/task/index_task.rb +1 -1
  44. data/lib/aerospike/user_role.rb +1 -1
  45. data/lib/aerospike/utils/buffer.rb +12 -0
  46. data/lib/aerospike/utils/pool.rb +1 -1
  47. data/lib/aerospike/value/value.rb +6 -6
  48. data/lib/aerospike/version.rb +1 -1
  49. data/lib/aerospike.rb +6 -0
  50. metadata +11 -5
@@ -38,6 +38,7 @@ module Aerospike
38
38
  UINT32 = 'N'
39
39
  INT64 = 'q>'
40
40
  UINT64 = 'Q>'
41
+ UINT64LE = 'Q'
41
42
  DOUBLE = 'G'
42
43
 
43
44
  DEFAULT_BUFFER_SIZE = 16 * 1024
@@ -67,6 +68,12 @@ module Aerospike
67
68
  end
68
69
 
69
70
  def resize(length)
71
+ # Corrupted data streams can result in a hug.length.
72
+ # Do a sanity check here.
73
+ if length > MAX_BUFFER_SIZE
74
+ raise Aerospike::Exceptions::Parse.new("Invalid size for buffer: #{length}")
75
+ end
76
+
70
77
  if @buf.bytesize < length
71
78
  @buf.concat("%0#{length - @buf.bytesize}d" % 0)
72
79
  end
@@ -156,6 +163,11 @@ module Aerospike
156
163
  vals.unpack(INT64)[0]
157
164
  end
158
165
 
166
+ def read_uint64_little_endian(offset)
167
+ vals = @buf[offset..offset+7]
168
+ vals.unpack(UINT64LE)[0]
169
+ end
170
+
159
171
  def read_uint64(offset)
160
172
  vals = @buf[offset..offset+7]
161
173
  vals.unpack(UINT64)[0]
@@ -53,7 +53,7 @@ module Aerospike
53
53
  end
54
54
 
55
55
  def empty?
56
- @pool.length == 0
56
+ @pool.empty?
57
57
  end
58
58
 
59
59
  def length
@@ -26,19 +26,19 @@ module Aerospike
26
26
  def self.of(value, allow_64bits = false)
27
27
  case value
28
28
  when Integer
29
- if !allow_64bits
30
- if value.bit_length < 64
29
+ if allow_64bits
30
+ # used in bitwise operations
31
+ if value.bit_length <= 64
31
32
  res = IntegerValue.new(value)
32
33
  else
33
- # big nums > 2**63 are not supported
34
+ # nums with more than 64 bits are not supported
34
35
  raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported with more than 64 bits.")
35
36
  end
36
37
  else
37
- # used in bitwise operations
38
- if value.bit_length <= 64
38
+ if value.bit_length < 64
39
39
  res = IntegerValue.new(value)
40
40
  else
41
- # nums with more than 64 bits are not supported
41
+ # big nums > 2**63 are not supported
42
42
  raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported with more than 64 bits.")
43
43
  end
44
44
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.21.1"
3
+ VERSION = "2.23.0"
4
4
  end
data/lib/aerospike.rb CHANGED
@@ -160,6 +160,12 @@ require 'aerospike/query/query_command'
160
160
  require 'aerospike/query/scan_command'
161
161
  require 'aerospike/query/statement'
162
162
  require 'aerospike/query/pred_exp'
163
+ require 'aerospike/query/partition_tracker'
164
+ require 'aerospike/query/partition_status'
165
+ require 'aerospike/query/partition_filter'
166
+ require 'aerospike/query/node_partitions'
167
+ require 'aerospike/query/scan_executor'
168
+ require 'aerospike/query/scan_partition_command'
163
169
 
164
170
  require 'aerospike/query/pred_exp/and_or'
165
171
  require 'aerospike/query/pred_exp/geo_json_value'
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.21.1
4
+ version: 2.23.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: 2022-06-21 00:00:00.000000000 Z
12
+ date: 2022-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack
@@ -155,6 +155,10 @@ files:
155
155
  - lib/aerospike/policy/write_policy.rb
156
156
  - lib/aerospike/privilege.rb
157
157
  - lib/aerospike/query/filter.rb
158
+ - lib/aerospike/query/node_partitions.rb
159
+ - lib/aerospike/query/partition_filter.rb
160
+ - lib/aerospike/query/partition_status.rb
161
+ - lib/aerospike/query/partition_tracker.rb
158
162
  - lib/aerospike/query/pred_exp.rb
159
163
  - lib/aerospike/query/pred_exp/and_or.rb
160
164
  - lib/aerospike/query/pred_exp/geo_json_value.rb
@@ -166,6 +170,8 @@ files:
166
170
  - lib/aerospike/query/query_command.rb
167
171
  - lib/aerospike/query/recordset.rb
168
172
  - lib/aerospike/query/scan_command.rb
173
+ - lib/aerospike/query/scan_executor.rb
174
+ - lib/aerospike/query/scan_partition_command.rb
169
175
  - lib/aerospike/query/statement.rb
170
176
  - lib/aerospike/query/stream_command.rb
171
177
  - lib/aerospike/record.rb
@@ -212,8 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
218
  - !ruby/object:Gem::Version
213
219
  version: '0'
214
220
  requirements: []
215
- rubygems_version: 3.2.15
216
- signing_key:
221
+ rubygems_version: 3.1.6
222
+ signing_key:
217
223
  specification_version: 4
218
224
  summary: An Aerospike driver for Ruby.
219
225
  test_files: []