aerospike 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/aerospike.rb +3 -4
  4. data/lib/aerospike/aerospike_exception.rb +7 -1
  5. data/lib/aerospike/atomic/atomic.rb +1 -1
  6. data/lib/aerospike/bin.rb +1 -1
  7. data/lib/aerospike/cdt/list_operation.rb +1 -1
  8. data/lib/aerospike/cdt/map_operation.rb +1 -1
  9. data/lib/aerospike/cdt/map_order.rb +1 -1
  10. data/lib/aerospike/cdt/map_policy.rb +1 -1
  11. data/lib/aerospike/cdt/map_return_type.rb +1 -1
  12. data/lib/aerospike/cdt/map_write_mode.rb +1 -1
  13. data/lib/aerospike/client.rb +9 -9
  14. data/lib/aerospike/cluster.rb +92 -17
  15. data/lib/aerospike/cluster/partition.rb +1 -1
  16. data/lib/aerospike/cluster/partition_parser.rb +169 -0
  17. data/lib/aerospike/command/admin_command.rb +1 -1
  18. data/lib/aerospike/command/batch_direct_command.rb +1 -1
  19. data/lib/aerospike/command/batch_direct_exists_command.rb +1 -1
  20. data/lib/aerospike/command/batch_direct_node.rb +3 -3
  21. data/lib/aerospike/command/batch_index_node.rb +2 -2
  22. data/lib/aerospike/command/batch_item.rb +1 -1
  23. data/lib/aerospike/command/command.rb +21 -4
  24. data/lib/aerospike/command/delete_command.rb +5 -1
  25. data/lib/aerospike/command/execute_command.rb +1 -1
  26. data/lib/aerospike/command/exists_command.rb +5 -1
  27. data/lib/aerospike/command/field_type.rb +2 -1
  28. data/lib/aerospike/command/multi_command.rb +5 -1
  29. data/lib/aerospike/command/operate_command.rb +6 -1
  30. data/lib/aerospike/command/read_command.rb +5 -1
  31. data/lib/aerospike/command/read_header_command.rb +5 -1
  32. data/lib/aerospike/command/roles.rb +1 -1
  33. data/lib/aerospike/command/single_command.rb +9 -3
  34. data/lib/aerospike/command/touch_command.rb +5 -1
  35. data/lib/aerospike/command/unsupported_particle_type_validator.rb +1 -1
  36. data/lib/aerospike/command/write_command.rb +5 -1
  37. data/lib/aerospike/connection/create.rb +1 -1
  38. data/lib/aerospike/features.rb +1 -1
  39. data/lib/aerospike/geo_json.rb +1 -1
  40. data/lib/aerospike/host.rb +1 -1
  41. data/lib/aerospike/info.rb +1 -1
  42. data/lib/aerospike/key.rb +1 -1
  43. data/lib/aerospike/language.rb +1 -1
  44. data/lib/aerospike/node.rb +3 -6
  45. data/lib/aerospike/node/refresh/partitions.rb +6 -15
  46. data/lib/aerospike/node_validator.rb +4 -19
  47. data/lib/aerospike/operation.rb +1 -1
  48. data/lib/aerospike/policy/admin_policy.rb +1 -1
  49. data/lib/aerospike/policy/batch_policy.rb +1 -1
  50. data/lib/aerospike/policy/client_policy.rb +1 -1
  51. data/lib/aerospike/policy/commit_level.rb +1 -1
  52. data/lib/aerospike/policy/consistency_level.rb +1 -1
  53. data/lib/aerospike/policy/generation_policy.rb +1 -1
  54. data/lib/aerospike/policy/operate_policy.rb +1 -1
  55. data/lib/aerospike/policy/policy.rb +12 -3
  56. data/lib/aerospike/policy/priority.rb +1 -1
  57. data/lib/aerospike/policy/query_policy.rb +8 -1
  58. data/lib/aerospike/policy/record_bin_multiplicity.rb +1 -1
  59. data/lib/aerospike/policy/record_exists_action.rb +1 -1
  60. data/lib/aerospike/policy/replica.rb +38 -0
  61. data/lib/aerospike/policy/scan_policy.rb +8 -1
  62. data/lib/aerospike/policy/write_policy.rb +1 -1
  63. data/lib/aerospike/query/filter.rb +1 -1
  64. data/lib/aerospike/query/query_command.rb +10 -1
  65. data/lib/aerospike/query/recordset.rb +1 -1
  66. data/lib/aerospike/query/scan_command.rb +1 -1
  67. data/lib/aerospike/query/statement.rb +1 -1
  68. data/lib/aerospike/query/stream_command.rb +1 -1
  69. data/lib/aerospike/record.rb +1 -1
  70. data/lib/aerospike/result_code.rb +1 -1
  71. data/lib/aerospike/socket/base.rb +1 -1
  72. data/lib/aerospike/task/execute_task.rb +1 -1
  73. data/lib/aerospike/task/index_task.rb +1 -1
  74. data/lib/aerospike/task/task.rb +1 -1
  75. data/lib/aerospike/task/udf_register_task.rb +1 -1
  76. data/lib/aerospike/task/udf_remove_task.rb +1 -1
  77. data/lib/aerospike/ttl.rb +1 -1
  78. data/lib/aerospike/udf.rb +1 -1
  79. data/lib/aerospike/user_role.rb +1 -1
  80. data/lib/aerospike/utils/buffer.rb +1 -1
  81. data/lib/aerospike/utils/packer.rb +1 -1
  82. data/lib/aerospike/utils/pool.rb +1 -1
  83. data/lib/aerospike/utils/unpacker.rb +1 -1
  84. data/lib/aerospike/value/particle_type.rb +1 -1
  85. data/lib/aerospike/value/value.rb +1 -1
  86. data/lib/aerospike/version.rb +1 -1
  87. metadata +6 -6
  88. data/lib/aerospike/cluster/partition_tokenizer_new.rb +0 -130
  89. data/lib/aerospike/cluster/partition_tokenizer_old.rb +0 -135
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Copyright 2016-2017 Aerospike, Inc.
2
+ # Copyright 2016-2020 Aerospike, Inc.
3
3
  #
4
4
  # Portions may be licensed to Aerospike, Inc. under one or more contributor
5
5
  # license agreements.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # Copyright 2014-2018 Aerospike, Inc.
2
+ # Copyright 2014-2020 Aerospike, Inc.
3
3
  #
4
4
  # Portions may be licensed to Aerospike, Inc. under one or more contributor
5
5
  # license agreements.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Copyright 2016-2018 Aerospike, Inc.
2
+ # Copyright 2016-2020 Aerospike, Inc.
3
3
  #
4
4
  # Portions may be licensed to Aerospike, Inc. under one or more contributor
5
5
  # license agreements.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Copyright 2014-2017 Aerospike, Inc.
2
+ # Copyright 2014-2020 Aerospike, Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License")
5
5
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright 2014-2018 Aerospike, Inc.
3
+ # Copyright 2014-2020 Aerospike, Inc.
4
4
  #
5
5
  # Portions may be licensed to Aerospike, Inc. under one or more contributor
6
6
  # license agreements.
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Aerospike
3
- VERSION = "2.12.0"
3
+ VERSION = "2.13.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.12.0
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: 2020-04-21 00:00:00.000000000 Z
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/partition_tokenizer_new.rb
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,6 +136,7 @@ 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
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubygems_version: 3.1.2
200
- signing_key:
200
+ signing_key:
201
201
  specification_version: 4
202
202
  summary: An Aerospike driver for Ruby.
203
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