aerospike 2.14.0 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -3
- data/lib/aerospike.rb +3 -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/client.rb +3 -1
- data/lib/aerospike/command/command.rb +12 -1
- data/lib/aerospike/operation.rb +2 -0
- data/lib/aerospike/policy/replica.rb +1 -1
- data/lib/aerospike/result_code.rb +13 -0
- data/lib/aerospike/value/particle_type.rb +1 -1
- data/lib/aerospike/value/value.rb +47 -0
- data/lib/aerospike/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 703f1af2ab5b0050745490618dc48f4f1135b457523ebe69b6c35d9111c67037
|
4
|
+
data.tar.gz: 9fba2d0c3a53c93a46f3fc1635f9fcabfa2e7804191cf9f20bf79c306099e6ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eba3f39bbfd7399f7e424894521aeed62cbd4b28e74f81b1d5207485eca59d236497d05c5f5dbfdfadd2e8e52c01eebcf4a06c71ea5eedf272f3ee6efd5f23b5
|
7
|
+
data.tar.gz: 3d2b651ccc051d95255acf0affdebd41822fcd0d36461653987186183bf84100a4507601eb5a640a0972827968b765645e31c6f6eb1f2f82b25f564704cb2aa7
|
data/CHANGELOG.md
CHANGED
@@ -2,16 +2,24 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [2.
|
5
|
+
## [2.15.0] - 2020-10-05
|
6
6
|
|
7
7
|
* **New Features**
|
8
|
-
* Adds support for
|
8
|
+
* [CLIENT-1254] Adds support for HyperLogLog.
|
9
|
+
|
10
|
+
* **Changes**
|
11
|
+
* `Client#operate` now uses `OperatePolicy` by default.
|
12
|
+
|
13
|
+
## [2.14.0] - 2020-08-06
|
14
|
+
|
15
|
+
* **New Features**
|
16
|
+
* Adds support for rack-aware reads.
|
9
17
|
* Adds support for client-server compression.
|
10
18
|
|
11
19
|
* **Improvements**
|
12
20
|
* Adds support for `truncate-namespace` command.
|
13
21
|
|
14
|
-
## [2.13.0] -
|
22
|
+
## [2.13.0] - 2020-07-17
|
15
23
|
|
16
24
|
* **New Features**
|
17
25
|
* Adds support for replica policies.
|
data/lib/aerospike.rb
CHANGED
@@ -77,6 +77,9 @@ require 'aerospike/cdt/map_return_type'
|
|
77
77
|
require 'aerospike/cdt/map_write_flags'
|
78
78
|
require 'aerospike/cdt/map_write_mode'
|
79
79
|
require 'aerospike/cdt/map_policy'
|
80
|
+
require 'aerospike/cdt/hll_operation'
|
81
|
+
require 'aerospike/cdt/hll_write_flags'
|
82
|
+
require 'aerospike/cdt/hll_policy'
|
80
83
|
require 'aerospike/geo_json'
|
81
84
|
require 'aerospike/ttl'
|
82
85
|
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2016-2020 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
|
+
module Aerospike
|
18
|
+
module CDT
|
19
|
+
|
20
|
+
# HyperLogLog (HLL) operations.
|
21
|
+
# Requires server versions >= 4.9.
|
22
|
+
#
|
23
|
+
# HyperLogLog operations on HLL items nested in lists/maps are not currently
|
24
|
+
# supported by the server.
|
25
|
+
class HLLOperation < Operation
|
26
|
+
|
27
|
+
INIT = 0
|
28
|
+
ADD = 1
|
29
|
+
SET_UNION = 2
|
30
|
+
SET_COUNT = 3
|
31
|
+
FOLD = 4
|
32
|
+
COUNT = 50
|
33
|
+
UNION = 51
|
34
|
+
UNION_COUNT = 52
|
35
|
+
INTERSECT_COUNT = 53
|
36
|
+
SIMILARITY = 54
|
37
|
+
DESCRIBE = 55
|
38
|
+
|
39
|
+
attr_reader :hll_op, :values, :return_type, :policy, :index_bit_count, :minhash_bit_count
|
40
|
+
|
41
|
+
def initialize(op_type, hll_op, bin_name, values: nil, index_bit_count: nil, minhash_bit_count: nil, policy: nil)
|
42
|
+
@policy = policy
|
43
|
+
@op_type = op_type
|
44
|
+
@bin_name = bin_name
|
45
|
+
@bin_value = nil
|
46
|
+
@hll_op = hll_op
|
47
|
+
@index_bit_count = index_bit_count
|
48
|
+
@minhash_bit_count = minhash_bit_count
|
49
|
+
@values = values
|
50
|
+
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Create HLL init operation with minhash bits.
|
56
|
+
# Server creates a new HLL or resets an existing HLL.
|
57
|
+
# Server does not return a value.
|
58
|
+
#
|
59
|
+
# policy write policy, HLLPolicy::DEFAULT is default
|
60
|
+
# bin_name name of bin
|
61
|
+
# index_bit_count number of index bits. Must be between 4 and 16 inclusive.
|
62
|
+
# minhash_bit_count number of min hash bits. Must be between 4 and 58 inclusive.
|
63
|
+
def self.init(bin_name, index_bit_count, minhash_bit_count, policy = HLLPolicy::DEFAULT)
|
64
|
+
HLLOperation.new(Operation::HLL_MODIFY, INIT, bin_name, index_bit_count: index_bit_count, minhash_bit_count: minhash_bit_count, policy: policy)
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# Create HLL add operation with minhash bits.
|
69
|
+
# Server adds values to HLL set. If HLL bin does not exist, use index_bit_count and minhash_bit_count
|
70
|
+
# to create HLL bin. Server returns number of entries that caused HLL to update a register.
|
71
|
+
#
|
72
|
+
# policy write policy, HLLPolicy::DEFAULT is default
|
73
|
+
# bin_name name of bin
|
74
|
+
# list list of values to be added
|
75
|
+
# index_bit_count number of index bits. Must be between 4 and 16 inclusive.
|
76
|
+
# minhash_bit_count number of min hash bits. Must be between 4 and 58 inclusive.
|
77
|
+
def self.add(bin_name, *values, policy: HLLPolicy::DEFAULT, index_bit_count: -1, minhash_bit_count: -1)
|
78
|
+
HLLOperation.new(Operation::HLL_MODIFY, ADD, bin_name, index_bit_count: index_bit_count, minhash_bit_count: minhash_bit_count, values: values, policy: policy)
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Create HLL set union operation.
|
83
|
+
# Server sets union of specified HLL objects with HLL bin.
|
84
|
+
# Server does not return a value.
|
85
|
+
#
|
86
|
+
# policy write policy, HLLPolicy::DEFAULT is default
|
87
|
+
# bin_name name of bin
|
88
|
+
# list list of HLL objects
|
89
|
+
def self.set_union(bin_name, *values, policy: HLLPolicy::DEFAULT)
|
90
|
+
HLLOperation.new(Operation::HLL_MODIFY, SET_UNION, bin_name, values: values, policy: policy)
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create HLL refresh operation.
|
95
|
+
# Server updates the cached count (if stale) and returns the count.
|
96
|
+
#
|
97
|
+
# bin_name name of bin
|
98
|
+
def self.refresh_count(bin_name)
|
99
|
+
HLLOperation.new(Operation::HLL_MODIFY, SET_COUNT, bin_name)
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Create HLL fold operation.
|
104
|
+
# Servers folds index_bit_count to the specified value.
|
105
|
+
# This can only be applied when minhash_bit_count on the HLL bin is 0.
|
106
|
+
# Server does not return a value.
|
107
|
+
#
|
108
|
+
# bin_name name of bin
|
109
|
+
# index_bit_count number of index bits. Must be between 4 and 16 inclusive.
|
110
|
+
def self.fold(bin_name, index_bit_count)
|
111
|
+
HLLOperation.new(Operation::HLL_MODIFY, FOLD, bin_name, index_bit_count: index_bit_count)
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Create HLL getCount operation.
|
116
|
+
# Server returns estimated number of elements in the HLL bin.
|
117
|
+
#
|
118
|
+
# bin_name name of bin
|
119
|
+
def self.get_count(bin_name)
|
120
|
+
HLLOperation.new(Operation::HLL_READ, COUNT, bin_name)
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Create HLL getUnion operation.
|
125
|
+
# Server returns an HLL object that is the union of all specified HLL objects in the list
|
126
|
+
# with the HLL bin.
|
127
|
+
#
|
128
|
+
# bin_name name of bin
|
129
|
+
# list list of HLL objects
|
130
|
+
def self.get_union(bin_name, *values)
|
131
|
+
HLLOperation.new(Operation::HLL_READ, UNION, bin_name, values: values)
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# Create HLL getUnionCount operation.
|
136
|
+
# Server returns estimated number of elements that would be contained by the union of these
|
137
|
+
# HLL objects.
|
138
|
+
# bin_name name of bin
|
139
|
+
# list list of HLL objects
|
140
|
+
def self.get_union_count(bin_name, *values)
|
141
|
+
HLLOperation.new(Operation::HLL_READ, UNION_COUNT, bin_name, values: values)
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Create HLL getIntersectCount operation.
|
146
|
+
# Server returns estimated number of elements that would be contained by the intersection of
|
147
|
+
# these HLL objects.
|
148
|
+
#
|
149
|
+
# bin_name name of bin
|
150
|
+
# list list of HLL objects
|
151
|
+
def self.get_intersect_count(bin_name, *values)
|
152
|
+
HLLOperation.new(Operation::HLL_READ, INTERSECT_COUNT, bin_name, values: values)
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Create HLL getSimilarity operation.
|
157
|
+
# Server returns estimated similarity of these HLL objects. Return type is a double.
|
158
|
+
#
|
159
|
+
# bin_name name of bin
|
160
|
+
# list list of HLL objects
|
161
|
+
def self.get_similarity(bin_name, *values)
|
162
|
+
HLLOperation.new(Operation::HLL_READ, SIMILARITY, bin_name, values: values)
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Create HLL describe operation.
|
167
|
+
# Server returns index_bit_count and minhash_bit_count used to create HLL bin in a list of longs.
|
168
|
+
# The list size is 2.
|
169
|
+
#
|
170
|
+
# bin_name name of bin
|
171
|
+
def self.describe(bin_name)
|
172
|
+
HLLOperation.new(Operation::HLL_READ, DESCRIBE, bin_name)
|
173
|
+
end
|
174
|
+
|
175
|
+
def bin_value
|
176
|
+
@bin_value ||= pack_bin_value
|
177
|
+
end
|
178
|
+
|
179
|
+
private
|
180
|
+
|
181
|
+
def pack_bin_value
|
182
|
+
bytes = nil
|
183
|
+
Packer.use do |packer|
|
184
|
+
args = [hll_op]
|
185
|
+
args << values if values
|
186
|
+
args << index_bit_count if index_bit_count
|
187
|
+
args << minhash_bit_count if minhash_bit_count
|
188
|
+
args << policy.flags if policy
|
189
|
+
|
190
|
+
vv = ListValue.new(args)
|
191
|
+
vv.pack(packer)
|
192
|
+
bytes = packer.bytes
|
193
|
+
end
|
194
|
+
BytesValue.new(bytes)
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 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
|
+
module CDT
|
22
|
+
class HLLPolicy
|
23
|
+
|
24
|
+
attr_accessor :flags
|
25
|
+
|
26
|
+
def initialize(write_flags: HLLWriteFlags::DEFAULT)
|
27
|
+
@flags = write_flags
|
28
|
+
end
|
29
|
+
|
30
|
+
DEFAULT = HLLPolicy.new
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright 2020 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
|
+
module Aerospike
|
18
|
+
module CDT
|
19
|
+
|
20
|
+
##
|
21
|
+
# Map write bit flags.
|
22
|
+
# Requires server versions >= 4.3.
|
23
|
+
module HLLWriteFlags
|
24
|
+
|
25
|
+
##
|
26
|
+
# Default is Default. Allow create or update.
|
27
|
+
DEFAULT = 0
|
28
|
+
|
29
|
+
##
|
30
|
+
# CREATE_ONLY behaves like the following:
|
31
|
+
# If the bin already exists, the operation will be denied.
|
32
|
+
# If the bin does not exist, a new bin will be created.
|
33
|
+
CREATE_ONLY = 1
|
34
|
+
|
35
|
+
##
|
36
|
+
# UPDATE_ONLY behaves like the following:
|
37
|
+
# If the bin already exists, the bin will be overwritten.
|
38
|
+
# If the bin does not exist, the operation will be denied.
|
39
|
+
UPDATE_ONLY = 2
|
40
|
+
|
41
|
+
##
|
42
|
+
# NO_FAIL does not raise error if operation is denied.
|
43
|
+
NO_FAIL = 4
|
44
|
+
|
45
|
+
##
|
46
|
+
# ALLOW_FOLD allows the resulting set to be the minimum of provided index bits.
|
47
|
+
# Also, allow the usage of less precise HLL algorithms when minHash bits
|
48
|
+
# of all participating sets do not match.
|
49
|
+
ALLOW_FOLD = 8
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/aerospike/client.rb
CHANGED
@@ -44,6 +44,7 @@ module Aerospike
|
|
44
44
|
attr_accessor :default_read_policy
|
45
45
|
attr_accessor :default_scan_policy
|
46
46
|
attr_accessor :default_write_policy
|
47
|
+
attr_accessor :default_operate_policy
|
47
48
|
attr_accessor :cluster
|
48
49
|
|
49
50
|
def initialize(hosts = nil, policy: ClientPolicy.new, connect: true)
|
@@ -383,7 +384,7 @@ module Aerospike
|
|
383
384
|
# read the result, all in one database call. Operations are executed in
|
384
385
|
# the order they are specified.
|
385
386
|
def operate(key, operations, options = nil)
|
386
|
-
policy = create_policy(options,
|
387
|
+
policy = create_policy(options, OperatePolicy, default_operate_policy)
|
387
388
|
|
388
389
|
command = OperateCommand.new(@cluster, policy, key, operations)
|
389
390
|
execute_command(command)
|
@@ -827,6 +828,7 @@ module Aerospike
|
|
827
828
|
self.default_query_policy = create_policy(policies[:query], QueryPolicy)
|
828
829
|
self.default_scan_policy = create_policy(policies[:scan], ScanPolicy)
|
829
830
|
self.default_write_policy = create_policy(policies[:write], WritePolicy)
|
831
|
+
self.default_operate_policy = create_policy(policies[:operate], OperatePolicy)
|
830
832
|
end
|
831
833
|
|
832
834
|
def send_info_command(policy, command, node = nil)
|
@@ -59,6 +59,9 @@ module Aerospike
|
|
59
59
|
# Create only. Fail if record already exists.
|
60
60
|
INFO2_CREATE_ONLY = Integer(1 << 5)
|
61
61
|
|
62
|
+
# Return a result for every operation.
|
63
|
+
INFO2_RESPOND_ALL_OPS = Integer(1 << 7)
|
64
|
+
|
62
65
|
# This is the last of a multi-part message.
|
63
66
|
INFO3_LAST = Integer(1 << 0)
|
64
67
|
# Commit to master only before declaring success.
|
@@ -254,6 +257,7 @@ module Aerospike
|
|
254
257
|
read_attr = 0
|
255
258
|
write_attr = 0
|
256
259
|
read_header = false
|
260
|
+
record_bin_multiplicity = policy.record_bin_multiplicity == RecordBinMultiplicity::ARRAY
|
257
261
|
|
258
262
|
operations.each do |operation|
|
259
263
|
case operation.op_type
|
@@ -271,17 +275,24 @@ module Aerospike
|
|
271
275
|
read_attr |= INFO1_READ
|
272
276
|
read_header = true
|
273
277
|
|
274
|
-
when Aerospike::Operation::CDT_READ
|
278
|
+
when Aerospike::Operation::CDT_READ,Aerospike::Operation::HLL_READ
|
275
279
|
read_attr |= INFO1_READ
|
276
280
|
|
277
281
|
else
|
278
282
|
write_attr = INFO2_WRITE
|
279
283
|
end
|
280
284
|
|
285
|
+
if [Aerospike::Operation::HLL_MODIFY, Aerospike::Operation::HLL_READ].include?(operation.op_type)
|
286
|
+
record_bin_multiplicity = true
|
287
|
+
end
|
288
|
+
|
281
289
|
estimate_operation_size_for_operation(operation)
|
282
290
|
end
|
283
291
|
size_buffer
|
284
292
|
|
293
|
+
|
294
|
+
write_attr |= INFO2_RESPOND_ALL_OPS if write_attr != 0 && record_bin_multiplicity
|
295
|
+
|
285
296
|
if write_attr != 0
|
286
297
|
write_header_with_policy(policy, read_attr, write_attr, field_count, operations.length)
|
287
298
|
else
|
data/lib/aerospike/operation.rb
CHANGED
@@ -31,7 +31,7 @@ module Aerospike
|
|
31
31
|
# Try node on the same rack as the client first. If there are no nodes on the
|
32
32
|
# same rack, use SEQUENCE instead.
|
33
33
|
#
|
34
|
-
# ClientPolicy#rack_aware
|
34
|
+
# ClientPolicy#rack_aware, ClientPolicy#rack_id, and server rack
|
35
35
|
# configuration must also be set to enable this functionality.
|
36
36
|
PREFER_RACK = 3
|
37
37
|
|
@@ -60,6 +60,10 @@ module Aerospike
|
|
60
60
|
# exists.
|
61
61
|
KEY_EXISTS_ERROR = 5
|
62
62
|
|
63
|
+
# Bin already exists on a create-only operation.
|
64
|
+
BIN_EXISTS_ERROR = 6
|
65
|
+
|
66
|
+
|
63
67
|
# Expected cluster ID was not received.
|
64
68
|
CLUSTER_KEY_MISMATCH = 7
|
65
69
|
|
@@ -91,6 +95,9 @@ module Aerospike
|
|
91
95
|
# Unsupported Server Feature (e.g. Scan + UDF)
|
92
96
|
UNSUPPORTED_FEATURE = 16
|
93
97
|
|
98
|
+
# Bin not found on update-only operation.
|
99
|
+
BIN_NOT_FOUND = 17
|
100
|
+
|
94
101
|
# Specified bin name does not exist in record.
|
95
102
|
DEVICE_OVERLOAD = 18
|
96
103
|
|
@@ -244,6 +251,9 @@ module Aerospike
|
|
244
251
|
when KEY_EXISTS_ERROR
|
245
252
|
"Key already exists"
|
246
253
|
|
254
|
+
when BIN_EXISTS_ERROR
|
255
|
+
"Bin already exists on a create-only operation"
|
256
|
+
|
247
257
|
when CLUSTER_KEY_MISMATCH
|
248
258
|
"Cluster key mismatch"
|
249
259
|
|
@@ -274,6 +284,9 @@ module Aerospike
|
|
274
284
|
when UNSUPPORTED_FEATURE
|
275
285
|
"Unsupported Server Feature"
|
276
286
|
|
287
|
+
when BIN_NOT_FOUND
|
288
|
+
"Bin not found on update-only operation"
|
289
|
+
|
277
290
|
when DEVICE_OVERLOAD
|
278
291
|
"Device overload"
|
279
292
|
|
@@ -526,6 +526,49 @@ module Aerospike
|
|
526
526
|
|
527
527
|
end
|
528
528
|
|
529
|
+
# #######################################/
|
530
|
+
|
531
|
+
# HLLValue value. Encapsulates a HyperLogLog value.
|
532
|
+
# Supported by Aerospike server version 4.9 and later.
|
533
|
+
class HLLValue < Value #:nodoc:
|
534
|
+
|
535
|
+
def initialize(value)
|
536
|
+
@bytes = value
|
537
|
+
@bytes.force_encoding('binary')
|
538
|
+
|
539
|
+
self
|
540
|
+
end
|
541
|
+
|
542
|
+
def type
|
543
|
+
Aerospike::ParticleType::HLL
|
544
|
+
end
|
545
|
+
|
546
|
+
def get
|
547
|
+
self
|
548
|
+
end
|
549
|
+
|
550
|
+
def to_s
|
551
|
+
@bytes.to_s
|
552
|
+
end
|
553
|
+
|
554
|
+
def to_bytes
|
555
|
+
@bytes
|
556
|
+
end
|
557
|
+
|
558
|
+
def estimate_size
|
559
|
+
@bytes.bytesize
|
560
|
+
end
|
561
|
+
|
562
|
+
def write(buffer, offset)
|
563
|
+
buffer.write_binary(@bytes, offset)
|
564
|
+
end
|
565
|
+
|
566
|
+
def pack(packer)
|
567
|
+
packer.write(Aerospike::ParticleType::BLOB.chr + @bytes)
|
568
|
+
end
|
569
|
+
|
570
|
+
end
|
571
|
+
|
529
572
|
#######################################
|
530
573
|
|
531
574
|
def self.encoding
|
@@ -572,6 +615,10 @@ module Aerospike
|
|
572
615
|
hdrsz = 1 + 2 + (ncells * 8)
|
573
616
|
Aerospike::GeoJSON.new(buf.read(offset + hdrsz, length - hdrsz))
|
574
617
|
|
618
|
+
when Aerospike::ParticleType::HLL
|
619
|
+
bytes = buf.read(offset,length)
|
620
|
+
Aerospike::HLLValue.new(bytes)
|
621
|
+
|
575
622
|
else
|
576
623
|
nil
|
577
624
|
end
|
data/lib/aerospike/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khosrow Afroozeh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
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
|