aerospike 2.15.0 → 2.16.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 +9 -0
- data/lib/aerospike.rb +6 -0
- 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 +101 -0
- data/lib/aerospike/cdt/list_operation.rb +126 -96
- data/lib/aerospike/cdt/list_sort_flags.rb +10 -2
- data/lib/aerospike/cdt/map_operation.rb +153 -92
- data/lib/aerospike/command/command.rb +4 -5
- data/lib/aerospike/features.rb +3 -0
- data/lib/aerospike/operation.rb +5 -2
- data/lib/aerospike/value/value.rb +60 -5
- data/lib/aerospike/version.rb +1 -1
- metadata +8 -2
@@ -261,7 +261,8 @@ module Aerospike
|
|
261
261
|
|
262
262
|
operations.each do |operation|
|
263
263
|
case operation.op_type
|
264
|
-
when Aerospike::Operation::READ
|
264
|
+
when Aerospike::Operation::READ, Aerospike::Operation::CDT_READ,
|
265
|
+
Aerospike::Operation::HLL_READ, Aerospike::Operation::BIT_READ
|
265
266
|
read_attr |= INFO1_READ
|
266
267
|
|
267
268
|
# Read all bins if no bin is specified.
|
@@ -275,14 +276,12 @@ module Aerospike
|
|
275
276
|
read_attr |= INFO1_READ
|
276
277
|
read_header = true
|
277
278
|
|
278
|
-
when Aerospike::Operation::CDT_READ,Aerospike::Operation::HLL_READ
|
279
|
-
read_attr |= INFO1_READ
|
280
|
-
|
281
279
|
else
|
282
280
|
write_attr = INFO2_WRITE
|
283
281
|
end
|
284
282
|
|
285
|
-
if [Aerospike::Operation::HLL_MODIFY, Aerospike::Operation::HLL_READ
|
283
|
+
if [Aerospike::Operation::HLL_MODIFY, Aerospike::Operation::HLL_READ,
|
284
|
+
Aerospike::Operation::BIT_MODIFY, Aerospike::Operation::BIT_READ].include?(operation.op_type)
|
286
285
|
record_bin_multiplicity = true
|
287
286
|
end
|
288
287
|
|
data/lib/aerospike/features.rb
CHANGED
data/lib/aerospike/operation.rb
CHANGED
@@ -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,14 +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
|
35
37
|
HLL_READ = 15
|
36
38
|
HLL_MODIFY = 16
|
37
39
|
|
38
|
-
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)
|
39
41
|
@op_type = op_type
|
40
42
|
@bin_name = bin_name
|
41
43
|
@bin_value = Value.of(bin_value)
|
44
|
+
@ctx = ctx
|
42
45
|
self
|
43
46
|
end
|
44
47
|
|
@@ -23,14 +23,24 @@ module Aerospike
|
|
23
23
|
# Polymorphic value classes used to efficiently serialize objects into the wire protocol.
|
24
24
|
class Value #:nodoc:
|
25
25
|
|
26
|
-
def self.of(value)
|
26
|
+
def self.of(value, allow_64bits = false)
|
27
27
|
case value
|
28
28
|
when Integer
|
29
|
-
if
|
30
|
-
|
29
|
+
if !allow_64bits
|
30
|
+
if value.bit_length < 64
|
31
|
+
res = IntegerValue.new(value)
|
32
|
+
else
|
33
|
+
# big nums > 2**63 are not supported
|
34
|
+
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported with more than 64 bits.")
|
35
|
+
end
|
31
36
|
else
|
32
|
-
#
|
33
|
-
|
37
|
+
# used in bitwise operations
|
38
|
+
if value.bit_length <= 64
|
39
|
+
res = IntegerValue.new(value)
|
40
|
+
else
|
41
|
+
# nums with more than 64 bits are not supported
|
42
|
+
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported with more than 64 bits.")
|
43
|
+
end
|
34
44
|
end
|
35
45
|
when Float
|
36
46
|
res = FloatValue.new(value)
|
@@ -48,6 +58,8 @@ module Aerospike
|
|
48
58
|
res = GeoJSONValue.new(value)
|
49
59
|
when nil
|
50
60
|
res = NULL
|
61
|
+
when TrueClass, FalseClass
|
62
|
+
res = BoolValue.new(value)
|
51
63
|
else
|
52
64
|
# throw an exception for anything that is not supported.
|
53
65
|
raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::TYPE_NOT_SUPPORTED, "Value type #{value.class} not supported.")
|
@@ -640,4 +652,47 @@ module Aerospike
|
|
640
652
|
nil
|
641
653
|
end
|
642
654
|
end
|
655
|
+
|
656
|
+
private
|
657
|
+
|
658
|
+
#######################################
|
659
|
+
|
660
|
+
# Boolean value.
|
661
|
+
# This is private, and only used internally for bitwise CDTs
|
662
|
+
class BoolValue < Value #:nodoc:
|
663
|
+
|
664
|
+
def initialize(val)
|
665
|
+
@value = val || false
|
666
|
+
self
|
667
|
+
end
|
668
|
+
|
669
|
+
def estimate_size
|
670
|
+
1
|
671
|
+
end
|
672
|
+
|
673
|
+
def write(buffer, offset)
|
674
|
+
raise Exception.new("Unreachable")
|
675
|
+
end
|
676
|
+
|
677
|
+
def pack(packer)
|
678
|
+
packer.write(@value)
|
679
|
+
end
|
680
|
+
|
681
|
+
def type
|
682
|
+
raise Exception.new("Unreachable")
|
683
|
+
end
|
684
|
+
|
685
|
+
def get
|
686
|
+
@value
|
687
|
+
end
|
688
|
+
|
689
|
+
def to_bytes
|
690
|
+
raise Exception.new("Unreachable")
|
691
|
+
end
|
692
|
+
|
693
|
+
def to_s
|
694
|
+
@value.to_s
|
695
|
+
end
|
696
|
+
|
697
|
+
end # BoolValue
|
643
698
|
end # module
|
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.16.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-10-
|
12
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -55,6 +55,12 @@ 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/bit_operation.rb
|
59
|
+
- lib/aerospike/cdt/bit_overflow_action.rb
|
60
|
+
- lib/aerospike/cdt/bit_policy.rb
|
61
|
+
- lib/aerospike/cdt/bit_resize_flags.rb
|
62
|
+
- lib/aerospike/cdt/bit_write_flags.rb
|
63
|
+
- lib/aerospike/cdt/context.rb
|
58
64
|
- lib/aerospike/cdt/hll_operation.rb
|
59
65
|
- lib/aerospike/cdt/hll_policy.rb
|
60
66
|
- lib/aerospike/cdt/hll_write_flags.rb
|