aerospike 2.16.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 +8 -0
- data/lib/aerospike/cdt/context.rb +12 -0
- data/lib/aerospike/cdt/list_operation.rb +36 -7
- data/lib/aerospike/cdt/list_order.rb +7 -0
- data/lib/aerospike/cdt/map_operation.rb +42 -16
- data/lib/aerospike/cdt/map_order.rb +3 -3
- data/lib/aerospike/utils/unpacker.rb +2 -2
- data/lib/aerospike/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05c5920ff4ef2281b4155d7f62dabb7ab48880a51397c871e9445c479d4bbe95
|
4
|
+
data.tar.gz: 6f0284dbf9d2bd3242386991038b2b9ad26ed9a168dc51aa117c19c704b33478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec901c240d80fea754256209ffa4fc0002e73c2f52b5c170beff06a180f8a02fc5bdad1fd315a02aa3efe988430b0c7aac569df890ae0606f4b9ed4ee533d4f
|
7
|
+
data.tar.gz: 66630fb1995c507a93ca9b72ee2fabaab57a7697340893b318bdf4f8063628599fdcf9f0a60343fd717ae5770a9331b0aa80ac6c14ee7c4aa01217acf3d470a4
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [2.17.0] - 2020-10-15
|
6
|
+
|
7
|
+
* **New Features**
|
8
|
+
* [CLIENT-1246] Adds missing API for Context#list_index_create and Context#map_key_create
|
9
|
+
|
10
|
+
* **Bug Fixes**
|
11
|
+
* Fixed an issue were MsgPack extensions were not recursively cleared from the CDTs during unpacking.
|
12
|
+
|
5
13
|
## [2.16.0] - 2020-10-12
|
6
14
|
|
7
15
|
* **New Features**
|
@@ -34,6 +34,12 @@ module Aerospike
|
|
34
34
|
@value = value
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# Create list with given type at index offset, given an order and pad.
|
39
|
+
def self.list_index_create(index, order, pad)
|
40
|
+
Context.new(0x10 | ListOrder.flag(order, pad), index)
|
41
|
+
end
|
42
|
+
|
37
43
|
##
|
38
44
|
# Lookup list by index offset.
|
39
45
|
# If the index is negative, the resolved index starts backwards from end of list.
|
@@ -90,6 +96,12 @@ module Aerospike
|
|
90
96
|
Context.new(0x22, key)
|
91
97
|
end
|
92
98
|
|
99
|
+
##
|
100
|
+
# Create map with given type at map key.
|
101
|
+
def self.map_key_create(key, order)
|
102
|
+
Context.new(0x22 | order[:flag], key)
|
103
|
+
end
|
104
|
+
|
93
105
|
##
|
94
106
|
# Lookup map by value.
|
95
107
|
def self.map_value(key)
|
@@ -84,18 +84,33 @@ module Aerospike
|
|
84
84
|
REMOVE_BY_RANK_RANGE = 39
|
85
85
|
REMOVE_BY_VALUE_REL_RANK_RANGE = 40
|
86
86
|
|
87
|
-
attr_reader :list_op, :arguments, :policy, :return_type, :ctx
|
87
|
+
attr_reader :list_op, :arguments, :policy, :return_type, :ctx, :flag
|
88
88
|
|
89
|
-
def initialize(op_type, list_op, bin_name, *arguments, return_type: nil, ctx: nil)
|
89
|
+
def initialize(op_type, list_op, bin_name, *arguments, return_type: nil, ctx: nil, flag: nil)
|
90
90
|
@op_type = op_type
|
91
91
|
@bin_name = bin_name
|
92
92
|
@bin_value = nil
|
93
93
|
@list_op = list_op
|
94
94
|
@ctx = ctx
|
95
|
+
@flag = flag
|
95
96
|
@arguments = arguments
|
96
97
|
@return_type = return_type
|
97
98
|
end
|
98
99
|
|
100
|
+
##
|
101
|
+
# creates list create operation.
|
102
|
+
# Server creates list at given context level. The context is allowed to be beyond list
|
103
|
+
# boundaries only if pad is set to true. In that case, nil list entries will be inserted to
|
104
|
+
# satisfy the context position.
|
105
|
+
def self.create(bin_name, order, pad, ctx: nil)
|
106
|
+
# If context not defined, the set order for top-level bin list.
|
107
|
+
if !ctx || ctx.length == 0
|
108
|
+
self.set_order(bin_name, order)
|
109
|
+
else
|
110
|
+
ListOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, order, ctx: ctx, flag: ListOrder.flag(order, pad))
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
99
114
|
##
|
100
115
|
# Create a set list order operation.
|
101
116
|
# Server sets list order.
|
@@ -504,11 +519,7 @@ module Aerospike
|
|
504
519
|
packer.write_array_header(3)
|
505
520
|
Value.of(0xff).pack(packer)
|
506
521
|
|
507
|
-
packer
|
508
|
-
@ctx.each do |ctx|
|
509
|
-
Value.of(ctx.id).pack(packer)
|
510
|
-
Value.of(ctx.value).pack(packer)
|
511
|
-
end
|
522
|
+
pack_context(packer)
|
512
523
|
|
513
524
|
packer.write_array_header(args.length+1)
|
514
525
|
Value.of(@list_op).pack(packer)
|
@@ -529,6 +540,24 @@ module Aerospike
|
|
529
540
|
end
|
530
541
|
BytesValue.new(bytes)
|
531
542
|
end
|
543
|
+
|
544
|
+
def pack_context(packer)
|
545
|
+
packer.write_array_header(@ctx.length*2)
|
546
|
+
if @flag
|
547
|
+
(1...@ctx.length).each do |i|
|
548
|
+
Value.of(@ctx[i].id).pack(packer)
|
549
|
+
Value.of(@ctx[i].value).pack(packer)
|
550
|
+
end
|
551
|
+
|
552
|
+
Value.of(@ctx[-1].id | @flag).pack(packer)
|
553
|
+
Value.of(@ctx[-1].value).pack(packer)
|
554
|
+
else
|
555
|
+
@ctx.each do |ctx|
|
556
|
+
Value.of(ctx.id).pack(packer)
|
557
|
+
Value.of(ctx.value).pack(packer)
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|
532
561
|
end
|
533
562
|
|
534
563
|
class InvertibleListOp < ListOperation
|
@@ -96,26 +96,39 @@ module Aerospike
|
|
96
96
|
GET_BY_KEY_REL_INDEX_RANGE = 109
|
97
97
|
GET_BY_VALUE_REL_RANK_RANGE = 110
|
98
98
|
|
99
|
-
attr_reader :map_op, :arguments, :return_type, :ctx
|
99
|
+
attr_reader :map_op, :arguments, :return_type, :ctx, :flag
|
100
100
|
|
101
|
-
def initialize(op_type, map_op, bin_name, *arguments, ctx: nil, return_type: nil)
|
101
|
+
def initialize(op_type, map_op, bin_name, *arguments, ctx: nil, return_type: nil, flag: nil)
|
102
102
|
@op_type = op_type
|
103
103
|
@bin_name = bin_name
|
104
104
|
@bin_value = nil
|
105
105
|
@map_op = map_op
|
106
106
|
@ctx = ctx
|
107
|
+
@flag = flag
|
107
108
|
@arguments = arguments
|
108
109
|
@return_type = return_type
|
109
110
|
self
|
110
111
|
end
|
111
112
|
|
113
|
+
##
|
114
|
+
# Creates a map create operation.
|
115
|
+
# Server creates map at given context level.
|
116
|
+
def self.create(bin_name, order, ctx: nil)
|
117
|
+
if !ctx || ctx.length == 0
|
118
|
+
# If context not defined, the set order for top-level bin map.
|
119
|
+
self.set_policy(MapPolicy.new(order: order, flag: 0), bin_name)
|
120
|
+
else
|
121
|
+
MapOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, order[:attr], ctx: ctx, flag: order[:flag])
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
112
125
|
##
|
113
126
|
# Create set map policy operation.
|
114
127
|
# Server sets map policy attributes. Server returns null.
|
115
128
|
#
|
116
129
|
# The required map policy attributes can be changed after the map is created.
|
117
130
|
def self.set_policy(bin_name, policy, ctx: nil)
|
118
|
-
MapOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, policy.order, ctx: ctx)
|
131
|
+
MapOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, policy.order[:attr], ctx: ctx)
|
119
132
|
end
|
120
133
|
|
121
134
|
##
|
@@ -126,16 +139,16 @@ module Aerospike
|
|
126
139
|
# The map policy also specifies the flags used when writing items to the map.
|
127
140
|
def self.put(bin_name, key, value, ctx: nil, policy: MapPolicy::DEFAULT)
|
128
141
|
if policy.flags != MapWriteFlags::DEFAULT
|
129
|
-
MapOperation.new(Operation::CDT_MODIFY, PUT, bin_name, key, value, policy.order, policy.flags, ctx: ctx)
|
142
|
+
MapOperation.new(Operation::CDT_MODIFY, PUT, bin_name, key, value, policy.order[:attr], policy.flags, ctx: ctx)
|
130
143
|
else
|
131
144
|
case policy.write_mode
|
132
145
|
when MapWriteMode::UPDATE_ONLY
|
133
146
|
# Replace doesn't allow map order because it does not create on non-existing key.
|
134
147
|
MapOperation.new(Operation::CDT_MODIFY, REPLACE, bin_name, key, value, ctx: ctx)
|
135
148
|
when MapWriteMode::CREATE_ONLY
|
136
|
-
MapOperation.new(Operation::CDT_MODIFY, ADD, bin_name, key, value, policy.order, ctx: ctx)
|
149
|
+
MapOperation.new(Operation::CDT_MODIFY, ADD, bin_name, key, value, policy.order[:attr], ctx: ctx)
|
137
150
|
else
|
138
|
-
MapOperation.new(Operation::CDT_MODIFY, PUT, bin_name, key, value, policy.order, ctx: ctx)
|
151
|
+
MapOperation.new(Operation::CDT_MODIFY, PUT, bin_name, key, value, policy.order[:attr], ctx: ctx)
|
139
152
|
end
|
140
153
|
end
|
141
154
|
end
|
@@ -148,16 +161,16 @@ module Aerospike
|
|
148
161
|
# The map policy also specifies the flags used when writing items to the map.
|
149
162
|
def self.put_items(bin_name, values, ctx: nil, policy: MapPolicy::DEFAULT)
|
150
163
|
if policy.flags != MapWriteFlags::DEFAULT
|
151
|
-
MapOperation.new(Operation::CDT_MODIFY, PUT_ITEMS, bin_name, values, policy.order, policy.flags, ctx: ctx)
|
164
|
+
MapOperation.new(Operation::CDT_MODIFY, PUT_ITEMS, bin_name, values, policy.order[:attr], policy.flags, ctx: ctx)
|
152
165
|
else
|
153
166
|
case policy.write_mode
|
154
167
|
when MapWriteMode::UPDATE_ONLY
|
155
168
|
# Replace doesn't allow map order because it does not create on non-existing key.
|
156
169
|
MapOperation.new(Operation::CDT_MODIFY, REPLACE_ITEMS, bin_name, values, ctx: ctx)
|
157
170
|
when MapWriteMode::CREATE_ONLY
|
158
|
-
MapOperation.new(Operation::CDT_MODIFY, ADD_ITEMS, bin_name, values, policy.order, ctx: ctx)
|
171
|
+
MapOperation.new(Operation::CDT_MODIFY, ADD_ITEMS, bin_name, values, policy.order[:attr], ctx: ctx)
|
159
172
|
else
|
160
|
-
MapOperation.new(Operation::CDT_MODIFY, PUT_ITEMS, bin_name, values, policy.order, ctx: ctx)
|
173
|
+
MapOperation.new(Operation::CDT_MODIFY, PUT_ITEMS, bin_name, values, policy.order[:attr], ctx: ctx)
|
161
174
|
end
|
162
175
|
end
|
163
176
|
end
|
@@ -170,7 +183,7 @@ module Aerospike
|
|
170
183
|
# The map policy dictates the type of map to create when it does not exist.
|
171
184
|
# The map policy also specifies the mode used when writing items to the map.
|
172
185
|
def self.increment(bin_name, key, incr, ctx: nil, policy: MapPolicy::DEFAULT)
|
173
|
-
MapOperation.new(Operation::CDT_MODIFY, INCREMENT, bin_name, key, incr, policy.order, ctx: ctx)
|
186
|
+
MapOperation.new(Operation::CDT_MODIFY, INCREMENT, bin_name, key, incr, policy.order[:attr], ctx: ctx)
|
174
187
|
end
|
175
188
|
|
176
189
|
##
|
@@ -181,7 +194,7 @@ module Aerospike
|
|
181
194
|
# The map policy dictates the type of map to create when it does not exist.
|
182
195
|
# The map policy also specifies the mode used when writing items to the map.
|
183
196
|
def self.decrement(bin_name, key, decr, ctx: nil, policy: MapPolicy::DEFAULT)
|
184
|
-
MapOperation.new(Operation::CDT_MODIFY, DECREMENT, bin_name, key, decr, policy.order, ctx: ctx)
|
197
|
+
MapOperation.new(Operation::CDT_MODIFY, DECREMENT, bin_name, key, decr, policy.order[:attr], ctx: ctx)
|
185
198
|
end
|
186
199
|
|
187
200
|
##
|
@@ -626,11 +639,7 @@ module Aerospike
|
|
626
639
|
packer.write_array_header(3)
|
627
640
|
Value.of(0xff).pack(packer)
|
628
641
|
|
629
|
-
packer
|
630
|
-
@ctx.each do |ctx|
|
631
|
-
Value.of(ctx.id).pack(packer)
|
632
|
-
Value.of(ctx.value).pack(packer)
|
633
|
-
end
|
642
|
+
pack_context(packer)
|
634
643
|
|
635
644
|
packer.write_array_header(args.length+1)
|
636
645
|
Value.of(@map_op).pack(packer)
|
@@ -651,6 +660,23 @@ module Aerospike
|
|
651
660
|
BytesValue.new(bytes)
|
652
661
|
end
|
653
662
|
|
663
|
+
def pack_context(packer)
|
664
|
+
packer.write_array_header(@ctx.length*2)
|
665
|
+
if @flag
|
666
|
+
(1...@ctx.length).each do |i|
|
667
|
+
Value.of(@ctx[i].id).pack(packer)
|
668
|
+
Value.of(@ctx[i].value).pack(packer)
|
669
|
+
end
|
670
|
+
|
671
|
+
Value.of(@ctx[-1].id | @flag).pack(packer)
|
672
|
+
Value.of(@ctx[-1].value).pack(packer)
|
673
|
+
else
|
674
|
+
@ctx.each do |ctx|
|
675
|
+
Value.of(ctx.id).pack(packer)
|
676
|
+
Value.of(ctx.value).pack(packer)
|
677
|
+
end
|
678
|
+
end
|
679
|
+
end
|
654
680
|
end
|
655
681
|
|
656
682
|
end
|
@@ -20,15 +20,15 @@ module Aerospike
|
|
20
20
|
|
21
21
|
##
|
22
22
|
# Map is not ordered. This is the default.
|
23
|
-
UNORDERED = 0
|
23
|
+
UNORDERED = {attr: 0, flag: 0x40}
|
24
24
|
|
25
25
|
##
|
26
26
|
# Order map by key.
|
27
|
-
KEY_ORDERED = 1
|
27
|
+
KEY_ORDERED = {attr: 1, flag: 0x80}
|
28
28
|
|
29
29
|
##
|
30
30
|
# Order map by key, then value.
|
31
|
-
KEY_VALUE_ORDERED = 3
|
31
|
+
KEY_VALUE_ORDERED = {attr: 3, flag: 0xc0}
|
32
32
|
|
33
33
|
##
|
34
34
|
# Default order
|
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.17.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-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|