aerospike 2.12.0 → 2.17.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/lib/aerospike.rb +17 -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/bit_operation.rb +376 -0
- data/lib/aerospike/cdt/bit_overflow_action.rb +46 -0
- data/lib/aerospike/cdt/bit_policy.rb +36 -0
- data/lib/aerospike/cdt/bit_resize_flags.rb +44 -0
- data/lib/aerospike/cdt/bit_write_flags.rb +51 -0
- data/lib/aerospike/cdt/context.rb +113 -0
- data/lib/aerospike/cdt/hll_operation.rb +200 -0
- data/lib/aerospike/cdt/hll_policy.rb +34 -0
- data/lib/aerospike/cdt/hll_write_flags.rb +53 -0
- data/lib/aerospike/cdt/list_operation.rb +156 -97
- data/lib/aerospike/cdt/list_order.rb +7 -0
- data/lib/aerospike/cdt/list_sort_flags.rb +10 -2
- data/lib/aerospike/cdt/map_operation.rb +180 -93
- data/lib/aerospike/cdt/map_order.rb +4 -4
- 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 +33 -16
- data/lib/aerospike/cluster.rb +139 -17
- data/lib/aerospike/cluster/partition.rb +1 -1
- data/lib/aerospike/cluster/partition_parser.rb +169 -0
- data/lib/aerospike/cluster/rack_parser.rb +117 -0
- data/lib/aerospike/command/admin_command.rb +1 -1
- data/lib/aerospike/command/batch_direct_command.rb +2 -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 +1 -0
- 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 +90 -8
- data/lib/aerospike/command/delete_command.rb +5 -1
- data/lib/aerospike/command/execute_command.rb +1 -1
- data/lib/aerospike/command/exists_command.rb +5 -1
- data/lib/aerospike/command/field_type.rb +2 -1
- data/lib/aerospike/command/multi_command.rb +49 -2
- data/lib/aerospike/command/operate_command.rb +6 -1
- data/lib/aerospike/command/read_command.rb +39 -3
- data/lib/aerospike/command/read_header_command.rb +5 -1
- data/lib/aerospike/command/roles.rb +1 -1
- data/lib/aerospike/command/single_command.rb +9 -3
- data/lib/aerospike/command/touch_command.rb +39 -2
- data/lib/aerospike/command/unsupported_particle_type_validator.rb +1 -1
- data/lib/aerospike/command/write_command.rb +5 -1
- data/lib/aerospike/connection/create.rb +1 -1
- data/lib/aerospike/features.rb +6 -1
- data/lib/aerospike/geo_json.rb +1 -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 +21 -7
- data/lib/aerospike/node/rebalance.rb +50 -0
- data/lib/aerospike/node/refresh/info.rb +4 -1
- data/lib/aerospike/node/refresh/partitions.rb +6 -15
- data/lib/aerospike/node/refresh/racks.rb +47 -0
- data/lib/aerospike/node/refresh/reset.rb +1 -0
- data/lib/aerospike/node/verify/rebalance_generation.rb +43 -0
- data/lib/aerospike/node_validator.rb +4 -19
- data/lib/aerospike/operation.rb +8 -3
- 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 +16 -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 +19 -2
- 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 +45 -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/query_command.rb +10 -1
- data/lib/aerospike/query/recordset.rb +1 -1
- data/lib/aerospike/query/scan_command.rb +1 -1
- data/lib/aerospike/query/statement.rb +1 -1
- data/lib/aerospike/query/stream_command.rb +1 -1
- data/lib/aerospike/record.rb +1 -1
- data/lib/aerospike/result_code.rb +14 -1
- data/lib/aerospike/socket/base.rb +4 -3
- 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 +14 -4
- data/lib/aerospike/utils/packer.rb +1 -1
- data/lib/aerospike/utils/pool.rb +1 -1
- data/lib/aerospike/utils/unpacker.rb +3 -3
- data/lib/aerospike/value/particle_type.rb +2 -2
- data/lib/aerospike/value/value.rb +108 -6
- data/lib/aerospike/version.rb +1 -1
- metadata +19 -6
- data/lib/aerospike/cluster/partition_tokenizer_new.rb +0 -130
- data/lib/aerospike/cluster/partition_tokenizer_old.rb +0 -135
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Aerospike, Inc.
|
4
|
+
#
|
5
|
+
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
|
+
# license agreements.
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
9
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
10
|
+
# the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
16
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
17
|
+
# License for the specific language governing permissions and limitations under
|
18
|
+
# the License.
|
19
|
+
|
20
|
+
module Aerospike
|
21
|
+
class Node
|
22
|
+
# generic class for representing changes in eg. peer and partition generation
|
23
|
+
class Rebalance
|
24
|
+
attr_reader :generation
|
25
|
+
|
26
|
+
def initialize(generation = -1)
|
27
|
+
@generation = ::Aerospike::Atomic.new(generation)
|
28
|
+
@changed = ::Aerospike::Atomic.new(false)
|
29
|
+
end
|
30
|
+
|
31
|
+
def changed?
|
32
|
+
@changed.value == true
|
33
|
+
end
|
34
|
+
|
35
|
+
def eql?(generation)
|
36
|
+
@generation.value == generation
|
37
|
+
end
|
38
|
+
|
39
|
+
def reset_changed!
|
40
|
+
@changed.value = false
|
41
|
+
end
|
42
|
+
|
43
|
+
def update(new_generation)
|
44
|
+
return if @generation.value == new_generation
|
45
|
+
@generation.value = new_generation
|
46
|
+
@changed.value = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -24,14 +24,17 @@ module Aerospike
|
|
24
24
|
CMDS_BASE = %w[node partition-generation cluster-name].freeze
|
25
25
|
CMDS_PEERS = (CMDS_BASE + ['peers-generation']).freeze
|
26
26
|
CMDS_SERVICES = (CMDS_BASE + ['services']).freeze
|
27
|
+
CMDS_REBALANCE = (CMDS_PEERS + ['rebalance-generation']).freeze
|
27
28
|
|
28
29
|
class << self
|
29
30
|
def call(node, peers)
|
30
31
|
conn = node.tend_connection
|
31
32
|
if peers.use_peers?
|
32
|
-
|
33
|
+
cmds = node.cluster.rack_aware ? CMDS_REBALANCE : CMDS_PEERS
|
34
|
+
info_map = ::Aerospike::Info.request(conn, *cmds)
|
33
35
|
Verify::PeersGeneration.(node, info_map, peers)
|
34
36
|
Verify::PartitionGeneration.(node, info_map)
|
37
|
+
Verify::RebalanceGeneration.(node, info_map) if node.cluster.rack_aware
|
35
38
|
Verify::Name.(node, info_map)
|
36
39
|
Verify::ClusterName.(node, info_map)
|
37
40
|
else
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2018 Aerospike, Inc.
|
3
|
+
# Copyright 2018-2020 Aerospike, Inc.
|
4
4
|
#
|
5
5
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
6
|
# license agreements.
|
@@ -25,24 +25,15 @@ module Aerospike
|
|
25
25
|
def call(node, peers)
|
26
26
|
return unless should_refresh?(node, peers)
|
27
27
|
|
28
|
-
|
28
|
+
Aerospike.logger.info("Updating partitions for node #{node.name}")
|
29
|
+
conn = node.tend_connection
|
30
|
+
parser = PartitionParser.new(node, conn)
|
31
|
+
node.cluster.update_partitions(parser)
|
29
32
|
rescue ::Aerospike::Exceptions::Aerospike => e
|
30
|
-
|
33
|
+
conn.close
|
31
34
|
Refresh::Failed.(node, e)
|
32
35
|
end
|
33
36
|
|
34
|
-
# Return correct tokenizer depending on version
|
35
|
-
def tokenizer(node)
|
36
|
-
conn = node.tend_connection
|
37
|
-
if node.use_new_info?
|
38
|
-
Aerospike.logger.info("Updating partitions for node #{node.name} using new protocol")
|
39
|
-
PartitionTokenizerNew.new(conn)
|
40
|
-
else
|
41
|
-
Aerospike.logger.info("Updating partitions for node #{node.name} using old protocol")
|
42
|
-
PartitionTokenizerOld.new(conn)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
37
|
# Do not refresh partitions when node connection has already failed
|
47
38
|
# during this cluster tend iteration. Also, avoid "split cluster"
|
48
39
|
# case where this node thinks it's a 1-node cluster. Unchecked, such
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018-2020 Aerospike, Inc.
|
4
|
+
#
|
5
|
+
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
|
+
# license agreements.
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
9
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
10
|
+
# the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
16
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
17
|
+
# License for the specific language governing permissions and limitations under
|
18
|
+
# the License.
|
19
|
+
|
20
|
+
module Aerospike
|
21
|
+
class Node
|
22
|
+
module Refresh
|
23
|
+
module Racks
|
24
|
+
class << self
|
25
|
+
def call(node)
|
26
|
+
return unless should_refresh?(node)
|
27
|
+
|
28
|
+
Aerospike.logger.info("Updating racks for node #{node.name}")
|
29
|
+
conn = node.tend_connection
|
30
|
+
parser = RackParser.new(node, conn)
|
31
|
+
node.update_racks(parser)
|
32
|
+
rescue ::Aerospike::Exceptions::Aerospike => e
|
33
|
+
conn.close
|
34
|
+
Refresh::Failed.(node, e)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Do not refresh racks when node connection has already failed
|
38
|
+
# during this cluster tend iteration.
|
39
|
+
def should_refresh?(node)
|
40
|
+
return false if node.failed? || !node.active?
|
41
|
+
true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Aerospike, Inc.
|
4
|
+
#
|
5
|
+
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
6
|
+
# license agreements.
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
9
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
10
|
+
# the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
16
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
17
|
+
# License for the specific language governing permissions and limitations under
|
18
|
+
# the License.
|
19
|
+
|
20
|
+
module Aerospike
|
21
|
+
class Node
|
22
|
+
module Verify
|
23
|
+
# Fetch and set rebalance generation. If racks needs to be refreshed
|
24
|
+
# this will be indicated in node.rebalance_changed
|
25
|
+
module RebalanceGeneration
|
26
|
+
class << self
|
27
|
+
def call(node, info_map)
|
28
|
+
gen_string = info_map.fetch('rebalance-generation', nil)
|
29
|
+
|
30
|
+
raise Aerospike::Exceptions::Parse.new('rebalance-generation is empty') if gen_string.to_s.empty?
|
31
|
+
|
32
|
+
generation = gen_string.to_i
|
33
|
+
|
34
|
+
node.rebalance_generation.update(generation)
|
35
|
+
|
36
|
+
return unless node.rebalance_generation.changed?
|
37
|
+
Aerospike.logger.info("Node #{node.name} rebalance generation #{generation} changed")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2014-
|
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.
|
@@ -19,13 +19,11 @@
|
|
19
19
|
|
20
20
|
module Aerospike
|
21
21
|
class NodeValidator # :nodoc:
|
22
|
-
VERSION_REGEXP = /(?<v1>\d+)\.(?<v2>\d+)\.(?<v3>\d+).*/.freeze
|
23
22
|
|
24
|
-
attr_reader :host, :aliases, :name, :
|
23
|
+
attr_reader :host, :aliases, :name, :features, :cluster_name, :tls_options, :conn
|
25
24
|
|
26
25
|
def initialize(cluster, host, timeout, cluster_name, tls_options = {})
|
27
26
|
@cluster = cluster
|
28
|
-
@use_new_info = true
|
29
27
|
@features = Set.new
|
30
28
|
@host = host
|
31
29
|
@cluster_name = cluster_name
|
@@ -46,7 +44,7 @@ module Aerospike
|
|
46
44
|
begin
|
47
45
|
conn = Cluster::CreateConnection.(@cluster, Host.new(address, host.port, host.tls_name))
|
48
46
|
|
49
|
-
commands = %w[node
|
47
|
+
commands = %w[node features]
|
50
48
|
commands << address_command unless is_loopback?(address)
|
51
49
|
|
52
50
|
info_map = Info.request(conn, *commands)
|
@@ -58,16 +56,10 @@ module Aerospike
|
|
58
56
|
if features = info_map['features']
|
59
57
|
@features = features.split(';').to_set
|
60
58
|
end
|
61
|
-
|
62
|
-
# Check new info protocol support for >= 2.6.6 build
|
63
|
-
if build_version = info_map['build']
|
64
|
-
v1, v2, v3 = parse_version_string(build_version)
|
65
|
-
@use_new_info = v1.to_i > 2 || (v1.to_i == 2 && (v2.to_i > 6 || (v2.to_i == 6 && v3.to_i >= 6)))
|
66
|
-
end
|
67
59
|
end
|
68
60
|
|
69
61
|
unless is_loopback?(address)
|
70
|
-
aliases = info_map[address_command].split(',').map { |
|
62
|
+
aliases = info_map[address_command].split(',').map { |addr| get_alias(*addr.split(':')) }
|
71
63
|
end
|
72
64
|
ensure
|
73
65
|
conn.close if conn
|
@@ -103,12 +95,5 @@ module Aerospike
|
|
103
95
|
!!((hostname =~ Resolv::IPv4::Regex) || (hostname =~ Resolv::IPv6::Regex))
|
104
96
|
end
|
105
97
|
|
106
|
-
def parse_version_string(version)
|
107
|
-
if v = VERSION_REGEXP.match(version)
|
108
|
-
return v['v1'], v['v2'], v['v3']
|
109
|
-
end
|
110
|
-
|
111
|
-
raise Aerospike::Exceptions::Parse.new("Invalid build version string in Info: #{version}")
|
112
|
-
end
|
113
98
|
end # class
|
114
99
|
end # module
|
data/lib/aerospike/operation.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
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.
|
@@ -20,7 +20,7 @@ module Aerospike
|
|
20
20
|
|
21
21
|
class Operation
|
22
22
|
|
23
|
-
attr_reader :op_type, :bin_name, :bin_value
|
23
|
+
attr_reader :op_type, :bin_name, :bin_value, :ctx
|
24
24
|
|
25
25
|
READ = 1
|
26
26
|
READ_HEADER = 1
|
@@ -31,12 +31,17 @@ module Aerospike
|
|
31
31
|
APPEND = 9
|
32
32
|
PREPEND = 10
|
33
33
|
TOUCH = 11
|
34
|
+
BIT_READ = 12
|
35
|
+
BIT_MODIFY = 13
|
34
36
|
DELETE = 14
|
37
|
+
HLL_READ = 15
|
38
|
+
HLL_MODIFY = 16
|
35
39
|
|
36
|
-
def initialize(op_type, bin_name=nil, bin_value=NullValue.new)
|
40
|
+
def initialize(op_type, bin_name=nil, bin_value=NullValue.new, ctx = nil)
|
37
41
|
@op_type = op_type
|
38
42
|
@bin_name = bin_name
|
39
43
|
@bin_value = Value.of(bin_value)
|
44
|
+
@ctx = ctx
|
40
45
|
self
|
41
46
|
end
|
42
47
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
# Copyright 2014-
|
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.
|
@@ -27,6 +27,7 @@ module Aerospike
|
|
27
27
|
attr_accessor :cluster_name
|
28
28
|
attr_accessor :tls
|
29
29
|
attr_accessor :policies
|
30
|
+
attr_accessor :rack_aware, :rack_id
|
30
31
|
|
31
32
|
def initialize(opt={})
|
32
33
|
# Initial host connection timeout in seconds. The timeout when opening a connection
|
@@ -56,6 +57,20 @@ module Aerospike
|
|
56
57
|
|
57
58
|
# Default Policies
|
58
59
|
@policies = opt.fetch(:policies) { Hash.new }
|
60
|
+
|
61
|
+
# Track server rack data. This field is useful when directing read commands to the server node
|
62
|
+
# that contains the key and exists on the same rack as the client. This serves to lower cloud
|
63
|
+
# provider costs when nodes are distributed across different racks/data centers.
|
64
|
+
#
|
65
|
+
# ClientPolicy#rack_id, Replica#PREFER_RACK and server rack
|
66
|
+
# configuration must also be set to enable this functionality.
|
67
|
+
@rack_aware = opt[:rack_aware] || false
|
68
|
+
|
69
|
+
# Rack where this client instance resides.
|
70
|
+
#
|
71
|
+
# ClientPolicy#rack_aware, Replica#PREFER_RACK and server rack
|
72
|
+
# configuration must also be set to enable this functionality.
|
73
|
+
@rack_id = opt[:rack_id] || 0
|
59
74
|
end
|
60
75
|
|
61
76
|
def requires_authentication
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Copyright 2014-
|
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.
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
require 'aerospike/policy/priority'
|
17
17
|
require 'aerospike/policy/consistency_level'
|
18
|
+
require 'aerospike/policy/replica'
|
18
19
|
|
19
20
|
|
20
21
|
module Aerospike
|
@@ -23,7 +24,7 @@ module Aerospike
|
|
23
24
|
class Policy
|
24
25
|
|
25
26
|
attr_accessor :priority, :timeout, :max_retries, :sleep_between_retries, :consistency_level,
|
26
|
-
:predexp, :fail_on_filtered_out
|
27
|
+
:predexp, :fail_on_filtered_out, :replica, :use_compression
|
27
28
|
|
28
29
|
def initialize(opt={})
|
29
30
|
# Container object for transaction policy attributes used in all database
|
@@ -82,6 +83,22 @@ module Aerospike
|
|
82
83
|
# read operation.
|
83
84
|
@consistency_level = opt[:consistency_level] || Aerospike::ConsistencyLevel::CONSISTENCY_ONE
|
84
85
|
|
86
|
+
|
87
|
+
# Send read commands to the node containing the key's partition replica type.
|
88
|
+
# Write commands are not affected by this setting, because all writes are directed
|
89
|
+
# to the node containing the key's master partition.
|
90
|
+
#
|
91
|
+
# Default to sending read commands to the node containing the key's master partition.
|
92
|
+
@replica = opt[:replica] || Aerospike::Replica::MASTER
|
93
|
+
|
94
|
+
# Use zlib compression on write or batch read commands when the command buffer size is greater
|
95
|
+
# than 128 bytes. In addition, tell the server to compress its response on read commands.
|
96
|
+
# The server response compression threshold is also 128 bytes.
|
97
|
+
#
|
98
|
+
# This option will increase cpu and memory usage (for extra compressed buffers), but
|
99
|
+
# decrease the size of data sent over the network.
|
100
|
+
@use_compression = opt[:use_compression] || false
|
101
|
+
|
85
102
|
# Transaction timeout.
|
86
103
|
# This timeout is used to set the socket timeout and is also sent to the
|
87
104
|
# server along with the transaction in the wire protocol.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2014-
|
1
|
+
# Copyright 2014-2020 Aerospike, Inc.
|
2
2
|
#
|
3
3
|
# Portions may be licensed to Aerospike, Inc. under one or more contributor
|
4
4
|
# license agreements.
|
@@ -24,6 +24,7 @@ module Aerospike
|
|
24
24
|
|
25
25
|
attr_accessor :include_bin_data
|
26
26
|
attr_accessor :record_queue_size
|
27
|
+
attr_accessor :records_per_second
|
27
28
|
|
28
29
|
def initialize(opt={})
|
29
30
|
super(opt)
|
@@ -42,6 +43,12 @@ module Aerospike
|
|
42
43
|
# Default is 5000.
|
43
44
|
@record_queue_size = opt[:record_queue_size] || 5000
|
44
45
|
|
46
|
+
# Limit returned records per second (rps) rate for each server.
|
47
|
+
# Will not apply rps limit if records_per_second is zero.
|
48
|
+
# Currently only applicable to a query without a defined filter (scan).
|
49
|
+
# Default is 0
|
50
|
+
@records_per_second = opt[:records_per_second] || 0
|
51
|
+
|
45
52
|
self
|
46
53
|
end
|
47
54
|
|