aerospike 2.23.0 → 2.25.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 +321 -266
- data/lib/aerospike/cdt/map_policy.rb +16 -2
- data/lib/aerospike/cdt/map_return_type.rb +9 -1
- data/lib/aerospike/client.rb +52 -56
- data/lib/aerospike/command/command.rb +105 -97
- data/lib/aerospike/command/field_type.rb +25 -28
- data/lib/aerospike/command/operate_args.rb +99 -0
- data/lib/aerospike/command/operate_command.rb +6 -11
- data/lib/aerospike/exp/exp.rb +1329 -0
- data/lib/aerospike/exp/exp_bit.rb +388 -0
- data/lib/aerospike/exp/exp_hll.rb +169 -0
- data/lib/aerospike/exp/exp_list.rb +403 -0
- data/lib/aerospike/exp/exp_map.rb +493 -0
- data/lib/aerospike/exp/operation.rb +56 -0
- data/lib/aerospike/features.rb +13 -0
- data/lib/aerospike/operation.rb +20 -22
- data/lib/aerospike/policy/policy.rb +25 -12
- data/lib/aerospike/policy/query_policy.rb +35 -2
- data/lib/aerospike/policy/scan_policy.rb +0 -2
- data/lib/aerospike/query/query_command.rb +1 -1
- data/lib/aerospike/query/query_executor.rb +71 -0
- data/lib/aerospike/query/query_partition_command.rb +269 -0
- data/lib/aerospike/query/recordset.rb +9 -9
- data/lib/aerospike/query/scan_executor.rb +7 -5
- data/lib/aerospike/query/statement.rb +7 -0
- data/lib/aerospike/query/stream_command.rb +2 -1
- data/lib/aerospike/task/execute_task.rb +17 -14
- data/lib/aerospike/utils/buffer.rb +62 -35
- data/lib/aerospike/utils/packer.rb +7 -6
- data/lib/aerospike/value/value.rb +21 -51
- data/lib/aerospike/version.rb +1 -1
- data/lib/aerospike.rb +156 -146
- metadata +12 -3
@@ -13,7 +13,6 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
module Aerospike
|
16
|
-
|
17
16
|
private
|
18
17
|
|
19
18
|
# ExecuteTask is used to poll for long running server execute job completion.
|
@@ -29,19 +28,24 @@ module Aerospike
|
|
29
28
|
self
|
30
29
|
end
|
31
30
|
|
32
|
-
#
|
31
|
+
# queries all nodes for task completion status.
|
33
32
|
def all_nodes_done?
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
command = 'query-list'
|
39
|
-
end
|
33
|
+
modul = @scan ? "scan" : "query"
|
34
|
+
cmd1 = "query-show:trid=#{@task_id}"
|
35
|
+
cmd2 = modul + "-show:trid=#{@task_id}"
|
36
|
+
cmd3 = "jobs:module=" + modul + ";cmd=get-job;trid=#{@task_id}"
|
40
37
|
|
41
38
|
nodes = @cluster.nodes
|
42
39
|
done = false
|
43
40
|
|
44
41
|
nodes.each do |node|
|
42
|
+
command = cmd3
|
43
|
+
if node.supports_feature?(Aerospike::Features::PARTITION_QUERY)
|
44
|
+
command = cmd1
|
45
|
+
elsif node.supports_feature?(Aerospike::Features::QUERY_SHOW)
|
46
|
+
command = cmd2
|
47
|
+
end
|
48
|
+
|
45
49
|
conn = node.get_connection(0)
|
46
50
|
responseMap, _ = Info.request(conn, command)
|
47
51
|
node.put_connection(conn)
|
@@ -58,28 +62,27 @@ module Aerospike
|
|
58
62
|
|
59
63
|
b = index + find.length
|
60
64
|
response = response[b, response.length]
|
61
|
-
find =
|
65
|
+
find = "job_status="
|
62
66
|
index = response.index(find)
|
63
67
|
|
64
68
|
next unless index
|
65
69
|
|
66
70
|
b = index + find.length
|
67
71
|
response = response[b, response.length]
|
68
|
-
e = response.index(
|
72
|
+
e = response.index(":")
|
69
73
|
status = response[0, e]
|
70
74
|
|
71
75
|
case status
|
72
|
-
when
|
76
|
+
when "ABORTED"
|
73
77
|
raise Aerospike::Exceptions::QueryTerminated
|
74
|
-
when
|
78
|
+
when "IN PROGRESS"
|
75
79
|
return false
|
76
|
-
when
|
80
|
+
when "DONE"
|
77
81
|
done = true
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
81
85
|
done
|
82
86
|
end
|
83
|
-
|
84
87
|
end
|
85
88
|
end
|
@@ -17,36 +17,34 @@
|
|
17
17
|
# License for the specific language governing permissions and limitations under
|
18
18
|
# the License.
|
19
19
|
|
20
|
-
require
|
20
|
+
require "aerospike/utils/pool"
|
21
21
|
|
22
22
|
module Aerospike
|
23
|
-
|
24
23
|
private
|
25
24
|
|
26
25
|
# Buffer class to ease the work around
|
27
26
|
class Buffer #:nodoc:
|
28
|
-
|
29
27
|
@@buf_pool = Pool.new
|
30
28
|
@@buf_pool.create_proc = Proc.new { Buffer.new }
|
31
29
|
|
32
30
|
attr_accessor :buf
|
33
31
|
|
34
|
-
INT16 =
|
35
|
-
UINT16 =
|
36
|
-
UINT16LE =
|
37
|
-
INT32 =
|
38
|
-
UINT32 =
|
39
|
-
INT64 =
|
40
|
-
UINT64 =
|
41
|
-
UINT64LE =
|
42
|
-
DOUBLE =
|
32
|
+
INT16 = "s>"
|
33
|
+
UINT16 = "n"
|
34
|
+
UINT16LE = "v"
|
35
|
+
INT32 = "l>"
|
36
|
+
UINT32 = "N"
|
37
|
+
INT64 = "q>"
|
38
|
+
UINT64 = "Q>"
|
39
|
+
UINT64LE = "Q"
|
40
|
+
DOUBLE = "G"
|
43
41
|
|
44
42
|
DEFAULT_BUFFER_SIZE = 16 * 1024
|
45
43
|
MAX_BUFFER_SIZE = 10 * 1024 * 1024
|
46
44
|
|
47
|
-
def initialize(size=DEFAULT_BUFFER_SIZE, buf = nil)
|
45
|
+
def initialize(size = DEFAULT_BUFFER_SIZE, buf = nil)
|
48
46
|
@buf = (buf ? buf : ("%0#{size}d" % 0))
|
49
|
-
@buf.force_encoding(
|
47
|
+
@buf.force_encoding("binary")
|
50
48
|
@slice_end = @buf.bytesize
|
51
49
|
end
|
52
50
|
|
@@ -61,6 +59,7 @@ module Aerospike
|
|
61
59
|
def size
|
62
60
|
@buf.bytesize
|
63
61
|
end
|
62
|
+
|
64
63
|
alias_method :length, :size
|
65
64
|
|
66
65
|
def eat!(n)
|
@@ -125,12 +124,17 @@ module Aerospike
|
|
125
124
|
8
|
126
125
|
end
|
127
126
|
|
127
|
+
def write_uint64_little_endian(i, offset)
|
128
|
+
@buf[offset, 8] = [i].pack(UINT64LE)
|
129
|
+
8
|
130
|
+
end
|
131
|
+
|
128
132
|
def write_double(f, offset)
|
129
133
|
@buf[offset, 8] = [f].pack(DOUBLE)
|
130
134
|
8
|
131
135
|
end
|
132
136
|
|
133
|
-
def read(offset, len=nil)
|
137
|
+
def read(offset, len = nil)
|
134
138
|
if len
|
135
139
|
@buf[offset, len]
|
136
140
|
else
|
@@ -139,37 +143,37 @@ module Aerospike
|
|
139
143
|
end
|
140
144
|
|
141
145
|
def read_int16(offset)
|
142
|
-
vals = @buf[offset..offset+1]
|
146
|
+
vals = @buf[offset..offset + 1]
|
143
147
|
vals.unpack(INT16)[0]
|
144
148
|
end
|
145
149
|
|
146
150
|
def read_uint16(offset)
|
147
|
-
vals = @buf[offset..offset+1]
|
151
|
+
vals = @buf[offset..offset + 1]
|
148
152
|
vals.unpack(UINT16)[0]
|
149
153
|
end
|
150
154
|
|
151
155
|
def read_int32(offset)
|
152
|
-
vals = @buf[offset..offset+3]
|
156
|
+
vals = @buf[offset..offset + 3]
|
153
157
|
vals.unpack(INT32)[0]
|
154
158
|
end
|
155
159
|
|
156
160
|
def read_uint32(offset)
|
157
|
-
vals = @buf[offset..offset+3]
|
161
|
+
vals = @buf[offset..offset + 3]
|
158
162
|
vals.unpack(UINT32)[0]
|
159
163
|
end
|
160
164
|
|
161
165
|
def read_int64(offset)
|
162
|
-
vals = @buf[offset..offset+7]
|
166
|
+
vals = @buf[offset..offset + 7]
|
163
167
|
vals.unpack(INT64)[0]
|
164
168
|
end
|
165
169
|
|
166
170
|
def read_uint64_little_endian(offset)
|
167
|
-
vals = @buf[offset..offset+7]
|
171
|
+
vals = @buf[offset..offset + 7]
|
168
172
|
vals.unpack(UINT64LE)[0]
|
169
173
|
end
|
170
174
|
|
171
175
|
def read_uint64(offset)
|
172
|
-
vals = @buf[offset..offset+7]
|
176
|
+
vals = @buf[offset..offset + 7]
|
173
177
|
vals.unpack(UINT64)[0]
|
174
178
|
end
|
175
179
|
|
@@ -178,14 +182,14 @@ module Aerospike
|
|
178
182
|
i = 0
|
179
183
|
while i < len
|
180
184
|
val <<= 8
|
181
|
-
val |= @buf[offset+i].ord & 0xFF
|
185
|
+
val |= @buf[offset + i].ord & 0xFF
|
182
186
|
i = i.succ
|
183
187
|
end
|
184
188
|
val
|
185
189
|
end
|
186
190
|
|
187
191
|
def read_double(offset)
|
188
|
-
vals = @buf[offset..offset+7]
|
192
|
+
vals = @buf[offset..offset + 7]
|
189
193
|
vals.unpack(DOUBLE)[0]
|
190
194
|
end
|
191
195
|
|
@@ -194,25 +198,48 @@ module Aerospike
|
|
194
198
|
end
|
195
199
|
|
196
200
|
def to_s
|
197
|
-
@buf[0..@slice_end-1]
|
201
|
+
@buf[0..@slice_end - 1]
|
198
202
|
end
|
199
203
|
|
200
204
|
def reset
|
201
|
-
for i in 0..@buf.size-1
|
202
|
-
@buf[i] =
|
205
|
+
for i in 0..@buf.size - 1
|
206
|
+
@buf[i] = " "
|
203
207
|
end
|
204
208
|
end
|
205
209
|
|
206
|
-
def dump(
|
207
|
-
|
208
|
-
|
210
|
+
def dump(start = 0, finish = nil)
|
211
|
+
buf ||= @buf.bytes
|
212
|
+
finish ||= @slice_end - 1
|
213
|
+
width = 16
|
214
|
+
|
215
|
+
ascii = "|"
|
216
|
+
counter = 0
|
217
|
+
|
218
|
+
print "%08x " % start
|
219
|
+
@buf.bytes[start...finish].each do |c|
|
220
|
+
if counter >= start
|
221
|
+
print "%02x " % c
|
222
|
+
ascii << (c.between?(32, 126) ? c : ?.)
|
223
|
+
print " " if ascii.length == (width / 2 + 1)
|
224
|
+
if ascii.length > width
|
225
|
+
ascii << "|"
|
226
|
+
puts ascii
|
227
|
+
ascii = "|"
|
228
|
+
print "%08x " % (counter + 1)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
counter += 1
|
232
|
+
end
|
209
233
|
|
210
|
-
|
211
|
-
|
212
|
-
|
234
|
+
# print the remainder in buffer
|
235
|
+
if ascii.length.positive?
|
236
|
+
fill_size = ((width - ascii.length + 1) * 3)
|
237
|
+
fill_size += 1 if ascii.length <= (width / 2)
|
238
|
+
filler = " " * fill_size
|
239
|
+
print filler
|
240
|
+
ascii << "|"
|
241
|
+
puts ascii
|
213
242
|
end
|
214
243
|
end
|
215
|
-
|
216
244
|
end # buffer
|
217
|
-
|
218
245
|
end # module
|
@@ -14,13 +14,11 @@
|
|
14
14
|
# License for the specific language governing permissions and limitations under
|
15
15
|
# the License.
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
17
|
+
require "msgpack"
|
18
|
+
require "aerospike/utils/pool"
|
19
19
|
|
20
20
|
module Aerospike
|
21
|
-
|
22
21
|
class Packer < MessagePack::Packer #:nodoc:
|
23
|
-
|
24
22
|
AS_EXT_TYPE = -1
|
25
23
|
|
26
24
|
@@pool = Pool.new
|
@@ -44,9 +42,12 @@ module Aerospike
|
|
44
42
|
buffer << [val].pack("S>")
|
45
43
|
end
|
46
44
|
|
45
|
+
def write_raw(buf)
|
46
|
+
buffer.write(buf)
|
47
|
+
end
|
48
|
+
|
47
49
|
def bytes
|
48
|
-
self.to_s.force_encoding(
|
50
|
+
self.to_s.force_encoding("binary")
|
49
51
|
end
|
50
52
|
end
|
51
|
-
|
52
53
|
end
|
@@ -17,12 +17,11 @@
|
|
17
17
|
# License for the specific language governing permissions and limitations under
|
18
18
|
# the License.
|
19
19
|
|
20
|
-
require
|
20
|
+
require "aerospike/aerospike_exception"
|
21
21
|
|
22
22
|
module Aerospike
|
23
23
|
# Polymorphic value classes used to efficiently serialize objects into the wire protocol.
|
24
24
|
class Value #:nodoc:
|
25
|
-
|
26
25
|
def self.of(value, allow_64bits = false)
|
27
26
|
case value
|
28
27
|
when Integer
|
@@ -83,12 +82,10 @@ module Aerospike
|
|
83
82
|
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported as hash key.")
|
84
83
|
end
|
85
84
|
end
|
86
|
-
|
87
85
|
end # Value
|
88
86
|
|
89
87
|
# Empty value.
|
90
88
|
class NullValue < Value #:nodoc:
|
91
|
-
|
92
89
|
def initialize
|
93
90
|
self
|
94
91
|
end
|
@@ -102,7 +99,7 @@ module Aerospike
|
|
102
99
|
end
|
103
100
|
|
104
101
|
def to_s
|
105
|
-
|
102
|
+
""
|
106
103
|
end
|
107
104
|
|
108
105
|
def estimate_size
|
@@ -118,13 +115,12 @@ module Aerospike
|
|
118
115
|
end
|
119
116
|
|
120
117
|
def to_bytes
|
121
|
-
|
118
|
+
""
|
122
119
|
end
|
123
120
|
end
|
124
121
|
|
125
122
|
NULL = NullValue.new.freeze
|
126
123
|
|
127
|
-
|
128
124
|
# Infinity value.
|
129
125
|
class InfinityValue < Value #:nodoc:
|
130
126
|
def initialize
|
@@ -156,7 +152,7 @@ module Aerospike
|
|
156
152
|
end
|
157
153
|
|
158
154
|
def to_bytes
|
159
|
-
|
155
|
+
""
|
160
156
|
end
|
161
157
|
|
162
158
|
def to_msgpack_ext
|
@@ -197,7 +193,7 @@ module Aerospike
|
|
197
193
|
end
|
198
194
|
|
199
195
|
def to_bytes
|
200
|
-
|
196
|
+
""
|
201
197
|
end
|
202
198
|
|
203
199
|
def to_msgpack_ext
|
@@ -209,10 +205,9 @@ module Aerospike
|
|
209
205
|
|
210
206
|
# Byte array value.
|
211
207
|
class BytesValue < Value #:nodoc:
|
212
|
-
|
213
208
|
def initialize(value)
|
214
209
|
@bytes = value
|
215
|
-
@bytes.force_encoding(
|
210
|
+
@bytes.force_encoding("binary")
|
216
211
|
|
217
212
|
self
|
218
213
|
end
|
@@ -244,16 +239,14 @@ module Aerospike
|
|
244
239
|
def pack(packer)
|
245
240
|
packer.write(Aerospike::ParticleType::BLOB.chr + @bytes)
|
246
241
|
end
|
247
|
-
|
248
242
|
end # BytesValue
|
249
243
|
|
250
244
|
#######################################
|
251
245
|
|
252
246
|
# value string.
|
253
247
|
class StringValue < Value #:nodoc:
|
254
|
-
|
255
248
|
def initialize(val)
|
256
|
-
@value = val ||
|
249
|
+
@value = val || ""
|
257
250
|
self
|
258
251
|
end
|
259
252
|
|
@@ -289,14 +282,12 @@ module Aerospike
|
|
289
282
|
def to_sym
|
290
283
|
@value.to_sym
|
291
284
|
end
|
292
|
-
|
293
285
|
end # StringValue
|
294
286
|
|
295
287
|
#######################################
|
296
288
|
|
297
289
|
# Integer value.
|
298
290
|
class IntegerValue < Value #:nodoc:
|
299
|
-
|
300
291
|
def initialize(val)
|
301
292
|
@value = val || 0
|
302
293
|
self
|
@@ -326,20 +317,18 @@ module Aerospike
|
|
326
317
|
def to_bytes
|
327
318
|
# Convert integer to big endian unsigned 64 bits.
|
328
319
|
# @see http://ruby-doc.org/core-2.3.0/Array.html#method-i-pack
|
329
|
-
[@value].pack(
|
320
|
+
[@value].pack("Q>")
|
330
321
|
end
|
331
322
|
|
332
323
|
def to_s
|
333
324
|
@value.to_s
|
334
325
|
end
|
335
|
-
|
336
326
|
end # IntegerValue
|
337
327
|
|
338
328
|
#######################################
|
339
329
|
|
340
330
|
# Float value.
|
341
331
|
class FloatValue < Value #:nodoc:
|
342
|
-
|
343
332
|
def initialize(val)
|
344
333
|
@value = val || 0.0
|
345
334
|
self
|
@@ -367,13 +356,12 @@ module Aerospike
|
|
367
356
|
end
|
368
357
|
|
369
358
|
def to_bytes
|
370
|
-
[@value].pack(
|
359
|
+
[@value].pack("G")
|
371
360
|
end
|
372
361
|
|
373
362
|
def to_s
|
374
363
|
@value.to_s
|
375
364
|
end
|
376
|
-
|
377
365
|
end # FloatValue
|
378
366
|
|
379
367
|
#######################################
|
@@ -381,7 +369,6 @@ module Aerospike
|
|
381
369
|
# List value.
|
382
370
|
# Supported by Aerospike 3 servers only.
|
383
371
|
class ListValue < Value #:nodoc:
|
384
|
-
|
385
372
|
def initialize(list)
|
386
373
|
@list = list || []
|
387
374
|
end
|
@@ -415,7 +402,7 @@ module Aerospike
|
|
415
402
|
end
|
416
403
|
|
417
404
|
def to_s
|
418
|
-
@list.map{|v| v.to_s}.to_s
|
405
|
+
@list.map { |v| v.to_s }.to_s
|
419
406
|
end
|
420
407
|
|
421
408
|
private
|
@@ -430,15 +417,13 @@ module Aerospike
|
|
430
417
|
|
431
418
|
@bytes
|
432
419
|
end
|
433
|
-
|
434
420
|
end
|
435
421
|
|
436
422
|
# #######################################/
|
437
423
|
|
438
424
|
# Map value.
|
439
|
-
# Supported by Aerospike 3 servers only.
|
425
|
+
# Supported by Aerospike 3+ servers only.
|
440
426
|
class MapValue < Value #:nodoc:
|
441
|
-
|
442
427
|
def initialize(vmap)
|
443
428
|
@vmap = vmap || {}
|
444
429
|
end
|
@@ -475,7 +460,7 @@ module Aerospike
|
|
475
460
|
end
|
476
461
|
|
477
462
|
def to_s
|
478
|
-
@vmap.map{|k, v| "#{k.to_s} => #{v.to_s}" }.to_s
|
463
|
+
@vmap.map { |k, v| "#{k.to_s} => #{v.to_s}" }.to_s
|
479
464
|
end
|
480
465
|
|
481
466
|
private
|
@@ -490,7 +475,6 @@ module Aerospike
|
|
490
475
|
|
491
476
|
@bytes
|
492
477
|
end
|
493
|
-
|
494
478
|
end
|
495
479
|
|
496
480
|
# #######################################/
|
@@ -498,7 +482,6 @@ module Aerospike
|
|
498
482
|
# GeoJSON value.
|
499
483
|
# Supported by Aerospike server version 3.7 and later.
|
500
484
|
class GeoJSONValue < Value #:nodoc:
|
501
|
-
|
502
485
|
def initialize(json)
|
503
486
|
@json = json
|
504
487
|
@bytes = json.to_json
|
@@ -535,7 +518,6 @@ module Aerospike
|
|
535
518
|
def to_s
|
536
519
|
@json
|
537
520
|
end
|
538
|
-
|
539
521
|
end
|
540
522
|
|
541
523
|
# #######################################/
|
@@ -543,14 +525,19 @@ module Aerospike
|
|
543
525
|
# HLLValue value. Encapsulates a HyperLogLog value.
|
544
526
|
# Supported by Aerospike server version 4.9 and later.
|
545
527
|
class HLLValue < Value #:nodoc:
|
528
|
+
attr_reader :bytes
|
546
529
|
|
547
530
|
def initialize(value)
|
548
531
|
@bytes = value
|
549
|
-
@bytes.force_encoding(
|
532
|
+
@bytes.force_encoding("binary")
|
550
533
|
|
551
534
|
self
|
552
535
|
end
|
553
536
|
|
537
|
+
def ==(other)
|
538
|
+
@bytes.to_s == other.to_s
|
539
|
+
end
|
540
|
+
|
554
541
|
def type
|
555
542
|
Aerospike::ParticleType::HLL
|
556
543
|
end
|
@@ -578,7 +565,6 @@ module Aerospike
|
|
578
565
|
def pack(packer)
|
579
566
|
packer.write(Aerospike::ParticleType::BLOB.chr + @bytes)
|
580
567
|
end
|
581
|
-
|
582
568
|
end
|
583
569
|
|
584
570
|
#######################################
|
@@ -594,63 +580,49 @@ module Aerospike
|
|
594
580
|
protected
|
595
581
|
|
596
582
|
def self.bytes_to_particle(type, buf, offset, length) # :nodoc:
|
597
|
-
|
598
583
|
case type
|
599
584
|
when Aerospike::ParticleType::STRING
|
600
585
|
bytes = buf.read(offset, length)
|
601
586
|
bytes.force_encoding(Aerospike.encoding)
|
602
|
-
|
603
587
|
when Aerospike::ParticleType::INTEGER
|
604
588
|
buf.read_int64(offset)
|
605
|
-
|
606
589
|
when Aerospike::ParticleType::DOUBLE
|
607
590
|
buf.read_double(offset)
|
608
|
-
|
609
591
|
when Aerospike::ParticleType::BOOL
|
610
592
|
buf.read_bool(offset, length)
|
611
|
-
|
612
593
|
when Aerospike::ParticleType::BLOB
|
613
|
-
buf.read(offset,length)
|
614
|
-
|
594
|
+
buf.read(offset, length)
|
615
595
|
when Aerospike::ParticleType::LIST
|
616
596
|
Unpacker.use do |unpacker|
|
617
597
|
data = buf.read(offset, length)
|
618
598
|
unpacker.unpack(data)
|
619
599
|
end
|
620
|
-
|
621
600
|
when Aerospike::ParticleType::MAP
|
622
601
|
Unpacker.use do |unpacker|
|
623
602
|
data = buf.read(offset, length)
|
624
603
|
unpacker.unpack(data)
|
625
604
|
end
|
626
|
-
|
627
605
|
when Aerospike::ParticleType::GEOJSON
|
628
606
|
# ignore the flags for now
|
629
607
|
ncells = buf.read_int16(offset + 1)
|
630
608
|
hdrsz = 1 + 2 + (ncells * 8)
|
631
609
|
Aerospike::GeoJSON.new(buf.read(offset + hdrsz, length - hdrsz))
|
632
|
-
|
633
610
|
when Aerospike::ParticleType::HLL
|
634
|
-
bytes = buf.read(offset,length)
|
611
|
+
bytes = buf.read(offset, length)
|
635
612
|
Aerospike::HLLValue.new(bytes)
|
636
|
-
|
637
613
|
else
|
638
614
|
nil
|
639
615
|
end
|
640
616
|
end
|
641
617
|
|
642
618
|
def self.bytes_to_key_value(type, buf, offset, len) # :nodoc:
|
643
|
-
|
644
619
|
case type
|
645
620
|
when Aerospike::ParticleType::STRING
|
646
621
|
StringValue.new(buf.read(offset, len))
|
647
|
-
|
648
622
|
when Aerospike::ParticleType::INTEGER
|
649
623
|
IntegerValue.new(buf.read_var_int64(offset, len))
|
650
|
-
|
651
624
|
when Aerospike::ParticleType::BLOB
|
652
|
-
BytesValue.new(buf.read(offset,len))
|
653
|
-
|
625
|
+
BytesValue.new(buf.read(offset, len))
|
654
626
|
else
|
655
627
|
nil
|
656
628
|
end
|
@@ -663,7 +635,6 @@ module Aerospike
|
|
663
635
|
# Boolean value.
|
664
636
|
# Supported by Aerospike server 5.6+ only.
|
665
637
|
class BoolValue < Value #:nodoc:
|
666
|
-
|
667
638
|
def initialize(val)
|
668
639
|
@value = val || false
|
669
640
|
self
|
@@ -698,6 +669,5 @@ module Aerospike
|
|
698
669
|
def to_s
|
699
670
|
@value.to_s
|
700
671
|
end
|
701
|
-
|
702
672
|
end # BoolValue
|
703
673
|
end # module
|
data/lib/aerospike/version.rb
CHANGED