aerospike 3.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +13 -9
  4. data/lib/aerospike/batch_attr.rb +292 -0
  5. data/lib/aerospike/batch_delete.rb +48 -0
  6. data/lib/aerospike/batch_read.rb +97 -0
  7. data/lib/aerospike/batch_record.rb +83 -0
  8. data/lib/aerospike/batch_results.rb +38 -0
  9. data/lib/aerospike/batch_udf.rb +76 -0
  10. data/lib/aerospike/batch_write.rb +79 -0
  11. data/lib/aerospike/cdt/bit_operation.rb +4 -5
  12. data/lib/aerospike/cdt/map_return_type.rb +8 -0
  13. data/lib/aerospike/client.rb +37 -51
  14. data/lib/aerospike/cluster.rb +50 -46
  15. data/lib/aerospike/command/batch_index_command.rb +7 -11
  16. data/lib/aerospike/command/batch_index_node.rb +3 -4
  17. data/lib/aerospike/command/batch_operate_command.rb +151 -0
  18. data/lib/aerospike/command/batch_operate_node.rb +51 -0
  19. data/lib/aerospike/command/command.rb +125 -98
  20. data/lib/aerospike/command/single_command.rb +1 -1
  21. data/lib/aerospike/exp/exp.rb +39 -41
  22. data/lib/aerospike/exp/exp_bit.rb +24 -24
  23. data/lib/aerospike/exp/exp_hll.rb +12 -12
  24. data/lib/aerospike/exp/exp_list.rb +101 -92
  25. data/lib/aerospike/exp/exp_map.rb +116 -119
  26. data/lib/aerospike/exp/operation.rb +2 -2
  27. data/lib/aerospike/info.rb +2 -4
  28. data/lib/aerospike/node.rb +7 -3
  29. data/lib/aerospike/operation.rb +38 -0
  30. data/lib/aerospike/policy/batch_delete_policy.rb +71 -0
  31. data/lib/aerospike/policy/batch_policy.rb +53 -4
  32. data/lib/aerospike/policy/batch_read_policy.rb +55 -0
  33. data/lib/aerospike/policy/batch_udf_policy.rb +75 -0
  34. data/lib/aerospike/policy/batch_write_policy.rb +105 -0
  35. data/lib/aerospike/policy/policy.rb +20 -40
  36. data/lib/aerospike/policy/query_duration.rb +48 -0
  37. data/lib/aerospike/policy/query_policy.rb +13 -8
  38. data/lib/aerospike/query/server_command.rb +1 -0
  39. data/lib/aerospike/query/statement.rb +5 -21
  40. data/lib/aerospike/result_code.rb +7 -1
  41. data/lib/aerospike/utils/buffer.rb +15 -15
  42. data/lib/aerospike/version.rb +1 -1
  43. data/lib/aerospike.rb +14 -12
  44. metadata +17 -14
  45. data/lib/aerospike/command/batch_direct_command.rb +0 -105
  46. data/lib/aerospike/command/batch_direct_exists_command.rb +0 -51
  47. data/lib/aerospike/command/batch_direct_node.rb +0 -40
  48. data/lib/aerospike/query/pred_exp/and_or.rb +0 -32
  49. data/lib/aerospike/query/pred_exp/geo_json_value.rb +0 -41
  50. data/lib/aerospike/query/pred_exp/integer_value.rb +0 -32
  51. data/lib/aerospike/query/pred_exp/op.rb +0 -27
  52. data/lib/aerospike/query/pred_exp/regex.rb +0 -32
  53. data/lib/aerospike/query/pred_exp/regex_flags.rb +0 -23
  54. data/lib/aerospike/query/pred_exp/string_value.rb +0 -29
  55. data/lib/aerospike/query/pred_exp.rb +0 -192
@@ -16,7 +16,7 @@
16
16
 
17
17
  module Aerospike
18
18
 
19
- # List expression generator. See {@link Exp}.
19
+ # List expression generator. See {Exp}.
20
20
  #
21
21
  # The bin expression argument in these methods can be a reference to a bin or the
22
22
  # result of another expression. Expressions that modify bin values are only used
@@ -50,74 +50,74 @@ module Aerospike
50
50
  # Create expression that appends value to end of list.
51
51
  def self.append(value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
52
52
  bytes = Exp.pack(ctx, APPEND, value, policy.order, policy.flags)
53
- self.add_write(bin, bytes, ctx)
53
+ add_write(bin, bytes, ctx)
54
54
  end
55
55
 
56
56
  # Create expression that appends list items to end of list.
57
57
  def self.append_items(list, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
58
58
  bytes = Exp.pack(ctx, APPEND_ITEMS, list, policy.order, policy.flags)
59
- self.add_write(bin, bytes, ctx)
59
+ add_write(bin, bytes, ctx)
60
60
  end
61
61
 
62
62
  # Create expression that inserts value to specified index of list.
63
63
  def self.insert(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
64
64
  bytes = Exp.pack(ctx, INSERT, index, value, policy.flags)
65
- self.add_write(bin, bytes, ctx)
65
+ add_write(bin, bytes, ctx)
66
66
  end
67
67
 
68
68
  # Create expression that inserts each input list item starting at specified index of list.
69
69
  def self.insert_items(index, list, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
70
70
  bytes = Exp.pack(ctx, INSERT_ITEMS, index, list, policy.flags)
71
- self.add_write(bin, bytes, ctx)
71
+ add_write(bin, bytes, ctx)
72
72
  end
73
73
 
74
74
  # Create expression that increments list[index] by value.
75
75
  # Value expression should resolve to a number.
76
76
  def self.increment(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
77
77
  bytes = Exp.pack(ctx, INCREMENT, index, value, policy.order, policy.flags)
78
- self.add_write(bin, bytes, ctx)
78
+ add_write(bin, bytes, ctx)
79
79
  end
80
80
 
81
81
  # Create expression that sets item value at specified index in list.
82
82
  def self.set(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT)
83
83
  bytes = Exp.pack(ctx, SET, index, value, policy.flags)
84
- self.add_write(bin, bytes, ctx)
84
+ add_write(bin, bytes, ctx)
85
85
  end
86
86
 
87
87
  # Create expression that removes all items in list.
88
88
  def self.clear(bin, ctx: nil)
89
89
  bytes = Exp.pack(ctx, CLEAR)
90
- self.add_write(bin, bytes, ctx)
90
+ add_write(bin, bytes, ctx)
91
91
  end
92
92
 
93
93
  # Create expression that sorts list according to sort_flags.
94
94
  #
95
- # @param sort_flags sort flags. See {@link ListSortFlagsend.
95
+ # @param sort_flags sort flags. See {ListSortFlagsend.
96
96
  # @param bin bin or list value expression
97
97
  # @param ctx optional context path for nested CDT
98
98
  def self.sort(sort_flags, bin, ctx: nil)
99
99
  bytes = Exp.pack(ctx, SORT, sort_flags)
100
- self.add_write(bin, bytes, ctx)
100
+ add_write(bin, bytes, ctx)
101
101
  end
102
102
 
103
103
  # Create expression that removes list items identified by value.
104
104
  def self.remove_by_value(value, bin, ctx: nil)
105
105
  bytes = Exp.pack(ctx, REMOVE_BY_VALUE, CDT::ListReturnType::NONE, value)
106
- self.add_write(bin, bytes, ctx)
106
+ add_write(bin, bytes, ctx)
107
107
  end
108
108
 
109
109
  # Create expression that removes list items identified by values.
110
110
  def self.remove_by_value_list(values, bin, ctx: nil)
111
111
  bytes = Exp.pack(ctx, REMOVE_BY_VALUE_LIST, CDT::ListReturnType::NONE, values)
112
- self.add_write(bin, bytes, ctx)
112
+ add_write(bin, bytes, ctx)
113
113
  end
114
114
 
115
115
  # Create expression that removes list items identified by value range (value_begin inclusive, value_end exclusive).
116
116
  # If value_begin is nil, the range is less than value_end. If value_end is nil, the range is
117
117
  # greater than equal to value_begin.
118
118
  def self.remove_by_value_range(value_begin, value_end, bin, ctx: nil)
119
- bytes = self.pack_range_operation(REMOVE_BY_VALUE_INTERVAL, CDT::ListReturnType::NONE, value_begin, value_end, ctx)
120
- self.add_write(bin, bytes, ctx)
119
+ bytes = pack_range_operation(REMOVE_BY_VALUE_INTERVAL, CDT::ListReturnType::NONE, value_begin, value_end, ctx)
120
+ add_write(bin, bytes, ctx)
121
121
  end
122
122
 
123
123
  # Create expression that removes list items nearest to value and greater by relative rank with a count limit if provided.
@@ -132,44 +132,44 @@ module Aerospike
132
132
  # (3,3,7) = [11,15]
133
133
  # (3,-3,2) = []
134
134
  def self.remove_by_value_relative_rank_range(value, rank, bin, ctx: nil, count: nil)
135
- unless count.nil?
136
- bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank, count)
137
- else
138
- bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank)
139
- end
140
- self.add_write(bin, bytes, ctx)
135
+ bytes = if count.nil?
136
+ Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank)
137
+ else
138
+ Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank, count)
139
+ end
140
+ add_write(bin, bytes, ctx)
141
141
  end
142
142
 
143
143
  # Create expression that removes list item identified by index.
144
144
  def self.remove_by_index(index, bin, ctx: nil)
145
145
  bytes = Exp.pack(ctx, REMOVE_BY_INDEX, CDT::ListReturnType::NONE, index)
146
- self.add_write(bin, bytes, ctx)
146
+ add_write(bin, bytes, ctx)
147
147
  end
148
148
 
149
149
  # Create expression that removes "count" list items starting at specified index.
150
150
  def self.remove_by_index_range(index, bin, ctx: nil, count: nil)
151
- unless count.nil?
152
- bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index, count)
153
- else
154
- bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index)
155
- end
156
- self.add_write(bin, bytes, ctx)
151
+ bytes = if count.nil?
152
+ Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index)
153
+ else
154
+ Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index, count)
155
+ end
156
+ add_write(bin, bytes, ctx)
157
157
  end
158
158
 
159
159
  # Create expression that removes list item identified by rank.
160
160
  def self.remove_by_rank(rank, bin, ctx: nil)
161
161
  bytes = Exp.pack(ctx, REMOVE_BY_RANK, CDT::ListReturnType::NONE, rank)
162
- self.add_write(bin, bytes, ctx)
162
+ add_write(bin, bytes, ctx)
163
163
  end
164
164
 
165
165
  # Create expression that removes "count" list items starting at specified rank.
166
166
  def self.remove_by_rank_range(rank, bin, ctx: nil, count: nil)
167
- unless count.nil?
168
- bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank, count)
169
- else
170
- bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank)
171
- end
172
- self.add_write(bin, bytes, ctx)
167
+ bytes = if count.nil?
168
+ Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank)
169
+ else
170
+ Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank, count)
171
+ end
172
+ add_write(bin, bytes, ctx)
173
173
  end
174
174
 
175
175
  # Create expression that returns list size.
@@ -180,7 +180,7 @@ module Aerospike
180
180
  # end</pre>
181
181
  def self.size(bin, ctx: nil)
182
182
  bytes = Exp.pack(ctx, SIZE)
183
- self.add_read(bin, bytes, Exp::Type::INT)
183
+ add_read(bin, bytes, Exp::Type::INT)
184
184
  end
185
185
 
186
186
  # Create expression that selects list items identified by value and returns selected
@@ -193,13 +193,13 @@ module Aerospike
193
193
  # Exp.val(0))
194
194
  # end</pre>
195
195
  #
196
- # @param return_type metadata attributes to return. See {@link CDT::ListReturnType
196
+ # @param return_type metadata attributes to return. See {CDT::ListReturnType}
197
197
  # @param value search expression
198
198
  # @param bin list bin or list value expression
199
199
  # @param ctx optional context path for nested CDT
200
200
  def self.get_by_value(return_type, value, bin, ctx: nil)
201
201
  bytes = Exp.pack(ctx, GET_BY_VALUE, return_type, value)
202
- self.add_read(bin, bytes, get_value_type(return_type))
202
+ add_read(bin, bytes, get_value_type(return_type))
203
203
  end
204
204
 
205
205
  # Create expression that selects list items identified by value range and returns selected data
@@ -210,25 +210,25 @@ module Aerospike
210
210
  # ListExp.getByValueRange(CDT::ListReturnType::VALUE, Exp.val(10), Exp.val(20), Exp.listBin("a"))
211
211
  # end</pre>
212
212
  #
213
- # @param return_type metadata attributes to return. See {@link CDT::ListReturnType}
213
+ # @param return_type metadata attributes to return. See {CDT::ListReturnType}
214
214
  # @param value_begin begin expression inclusive. If nil, range is less than value_end.
215
215
  # @param value_end end expression exclusive. If nil, range is greater than equal to value_begin.
216
216
  # @param bin bin or list value expression
217
217
  # @param ctx optional context path for nested CDT
218
218
  def self.get_by_value_range(return_type, value_begin, value_end, bin, ctx: nil)
219
- bytes = self.pack_range_operation(GET_BY_VALUE_INTERVAL, return_type, value_begin, value_end, ctx)
220
- self.add_read(bin, bytes, get_value_type(return_type))
219
+ bytes = pack_range_operation(GET_BY_VALUE_INTERVAL, return_type, value_begin, value_end, ctx)
220
+ add_read(bin, bytes, get_value_type(return_type))
221
221
  end
222
222
 
223
223
  # Create expression that selects list items identified by values and returns selected data
224
224
  # specified by return_type.
225
225
  def self.get_by_value_list(return_type, values, bin, ctx: nil)
226
226
  bytes = Exp.pack(ctx, GET_BY_VALUE_LIST, return_type, values)
227
- self.add_read(bin, bytes, get_value_type(return_type))
227
+ add_read(bin, bytes, get_value_type(return_type))
228
228
  end
229
229
 
230
230
  # Create expression that selects list items nearest to value and greater by relative rank with a count limit
231
- # and returns selected data specified by return_type (See {@link CDT::ListReturnType).
231
+ # and returns selected data specified by return_type (See {CDT::ListReturnType}).
232
232
  #
233
233
  # Examples for ordered list [0,4,5,9,11,15]:
234
234
  #
@@ -240,12 +240,12 @@ module Aerospike
240
240
  # (3,3,7) = [11,15]
241
241
  # (3,-3,2) = []
242
242
  def self.get_by_value_relative_rank_range(return_type, value, rank, bin, ctx: nil, count: nil)
243
- unless count.nil?
244
- bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count)
245
- else
246
- bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank)
247
- end
248
- self.add_read(bin, bytes, get_value_type(return_type))
243
+ bytes = if count.nil?
244
+ Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank)
245
+ else
246
+ Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count)
247
+ end
248
+ add_read(bin, bytes, get_value_type(return_type))
249
249
  end
250
250
 
251
251
  # Create expression that selects list item identified by index and returns
@@ -258,32 +258,32 @@ module Aerospike
258
258
  # Exp.val(5))
259
259
  # end</pre>
260
260
  #
261
- # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend
261
+ # @param return_type metadata attributes to return. See {CDT::ListReturnType}
262
262
  # @param value_type expected type of value
263
263
  # @param index list index expression
264
264
  # @param bin list bin or list value expression
265
265
  # @param ctx optional context path for nested CDT
266
266
  def self.get_by_index(return_type, value_type, index, bin, ctx: nil)
267
267
  bytes = Exp.pack(ctx, GET_BY_INDEX, return_type, index)
268
- self.add_read(bin, bytes, value_type)
268
+ add_read(bin, bytes, value_type)
269
269
  end
270
270
 
271
271
  # Create expression that selects list items starting at specified index to the end of list
272
- # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend).
272
+ # and returns selected data specified by return_type (See {CDT::ListReturnType}).
273
273
  def self.get_by_index_range(return_type, index, bin, ctx: nil)
274
274
  bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index)
275
- self.add_read(bin, bytes, get_value_type(return_type))
275
+ add_read(bin, bytes, get_value_type(return_type))
276
276
  end
277
277
 
278
278
  # Create expression that selects "count" list items starting at specified index
279
- # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend).
279
+ # and returns selected data specified by return_type (See {CDT::ListReturnType}).
280
280
  def self.get_by_index_range(return_type, index, bin, ctx: nil, count: nil)
281
- unless count.nil?
282
- bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count)
283
- else
284
- bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index)
285
- end
286
- self.add_read(bin, bytes, get_value_type(return_type))
281
+ bytes = if count.nil?
282
+ Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index)
283
+ else
284
+ Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count)
285
+ end
286
+ add_read(bin, bytes, get_value_type(return_type))
287
287
  end
288
288
 
289
289
  # Create expression that selects list item identified by rank and returns selected
@@ -294,32 +294,32 @@ module Aerospike
294
294
  # ListExp.getByRank(CDT::ListReturnType::VALUE, Type.STRING, Exp.val(0), Exp.listBin("a"))
295
295
  # end</pre>
296
296
  #
297
- # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend
297
+ # @param return_type metadata attributes to return. See {CDT::ListReturnType}
298
298
  # @param value_type expected type of value
299
299
  # @param rank rank expression
300
300
  # @param bin list bin or list value expression
301
301
  # @param ctx optional context path for nested CDT
302
302
  def self.get_by_rank(return_type, value_type, rank, bin, ctx: nil)
303
303
  bytes = Exp.pack(ctx, GET_BY_RANK, return_type, rank)
304
- self.add_read(bin, bytes, value_type)
304
+ add_read(bin, bytes, value_type)
305
305
  end
306
306
 
307
307
  # Create expression that selects list items starting at specified rank to the last ranked item
308
- # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend).
308
+ # and returns selected data specified by return_type (See {CDT::ListReturnType}).
309
309
  def self.get_by_rank_range(return_type, rank, bin, ctx: nil)
310
310
  bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank)
311
- self.add_read(bin, bytes, get_value_type(return_type))
311
+ add_read(bin, bytes, get_value_type(return_type))
312
312
  end
313
313
 
314
314
  # Create expression that selects "count" list items starting at specified rank and returns
315
- # selected data specified by return_type (See {@link CDT::ListReturnTypeend).
315
+ # selected data specified by return_type (See {CDT::ListReturnType}).
316
316
  def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil)
317
- unless count.nil?
318
- bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count)
319
- else
320
- bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank)
321
- end
322
- self.add_read(bin, bytes, get_value_type(return_type))
317
+ bytes = if count.nil?
318
+ Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank)
319
+ else
320
+ Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count)
321
+ end
322
+ add_read(bin, bytes, get_value_type(return_type))
323
323
  end
324
324
 
325
325
  private
@@ -336,7 +336,7 @@ module Aerospike
336
336
  SIZE = 16
337
337
  GET_BY_INDEX = 19
338
338
  GET_BY_RANK = 21
339
- GET_BY_VALUE = 22 # GET_ALL_BY_VALUE on server
339
+ GET_BY_VALUE = 22 # GET_ALL_BY_VALUE on server
340
340
  GET_BY_VALUE_LIST = 23
341
341
  GET_BY_INDEX_RANGE = 24
342
342
  GET_BY_VALUE_INTERVAL = 25
@@ -352,11 +352,11 @@ module Aerospike
352
352
  REMOVE_BY_VALUE_REL_RANK_RANGE = 40
353
353
 
354
354
  def self.add_write(bin, bytes, ctx)
355
- if ctx.to_a.empty?
356
- ret_type = Exp::Type::LIST
357
- else
358
- ret_type = ((ctx[0].id & 0x10) == 0) ? Exp::Type::MAP : Exp::Type::LIST
359
- end
355
+ ret_type = if ctx.to_a.empty?
356
+ Exp::Type::LIST
357
+ else
358
+ (ctx[0].id & 0x10) == 0 ? Exp::Type::MAP : Exp::Type::LIST
359
+ end
360
360
  Exp::Module.new(bin, bytes, ret_type, MODULE | Exp::MODIFY)
361
361
  end
362
362
 
@@ -365,17 +365,28 @@ module Aerospike
365
365
  end
366
366
 
367
367
  def self.get_value_type(return_type)
368
- t = return_type & ~CDT::ListReturnType::INVERTED
369
- case t
370
- when CDT::ListReturnType::INDEX, CDT::ListReturnType::REVERSE_INDEX, CDT::ListReturnType::RANK, CDT::ListReturnType::REVERSE_RANK, CDT::ListReturnType::VALUE
368
+ t = return_type & ~CDT::ListReturnType::INVERTED
369
+ case t
370
+ when ListReturnType::INDEX,
371
+ ListReturnType::REVERSE_INDEX,
372
+ ListReturnType::RANK,
373
+ ListReturnType::REVERSE_RANK
374
+ # This method only called from expressions that can return multiple integers (ie list).
371
375
  Exp::Type::LIST
372
- when CDT::ListReturnType::COUNT
373
- Exp::Type::INT
374
- when CDT::ListReturnType::EXISTS
376
+
377
+ when ListReturnType::COUNT
378
+ Exp::Type::INT
379
+
380
+ when ListReturnType::VALUE
381
+ # This method only called from expressions that can return multiple objects (ie list)::
382
+ Exp::Type::LIST
383
+
384
+ when ListReturnType::EXISTS
375
385
  Exp::Type::BOOL
376
- else
377
- raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::SERVER_ERROR, "Invalid MapReturnType: #{return_type}")
378
- end
386
+
387
+ else
388
+ raise Exceptions::Aerospike.new(Aerospike::ResultCode::PARAMETER_ERROR, "Invalid ListReturnType: #{return_type}")
389
+ end
379
390
  end
380
391
 
381
392
  def self.pack_range_operation(command, return_type, value_begin, value_end, ctx)
@@ -385,14 +396,12 @@ module Aerospike
385
396
  packer.write(command)
386
397
  packer.write(return_type)
387
398
 
388
- unless value_begin.nil?
389
- if value_begin.is_a?(Exp)
390
- value_begin.pack(packer)
391
- else
392
- Value.of(value_begin).pack(packer)
393
- end
394
- else
399
+ if value_begin.nil?
395
400
  packer.write(nil)
401
+ elsif value_begin.is_a?(Exp)
402
+ value_begin.pack(packer)
403
+ else
404
+ Value.of(value_begin).pack(packer)
396
405
  end
397
406
 
398
407
  unless value_end.nil?