Class: Aerospike::CDT::ListOperation

Inherits:
Operation
  • Object
show all
Defined in:
lib/aerospike/cdt/list_operation.rb

Overview

List operations support negative indexing. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. If a range is partially out of bounds, the valid part of the range will be returned. Index/Range examples:

Index/Range examples:

Index 0: First item in list.
Index 4: Fifth item in list.
Index -1: Last item in list.
Index -3: Third to last item in list.
Index 1 Count 2: Second and third items in list.
Index -3 Count 3: Last three items in list.
Index -5 Count 4: Range between fifth to last item to second to last item inclusive.

Nested CDT operations are supported by optional Ctx context arguments. Examples:

bin = [[7,9,5],,[6,5,4,1]] Append 11 to last list. ListOperation.append(“bin”, 11, ctx: [Context.list_index(-1)]) bin result = [[7,9,5],,[6,5,4,1,11]]

bin = ] Append 11 to lowest ranked list in map identified by “key2”. ListOperation.append(“bin”, 11, ctx: [Context.map_key(“key2”), Context.list_rank(0)]) bin result = ]

Direct Known Subclasses

InvertibleListOp

Constant Summary collapse

SET_TYPE =
0
APPEND =
1
APPEND_ITEMS =
2
INSERT =
3
INSERT_ITEMS =
4
POP =
5
POP_RANGE =
6
REMOVE =
7
REMOVE_RANGE =
8
SET =
9
TRIM =
10
CLEAR =
11
INCREMENT =
12
SORT =
13
SIZE =
16
GET =
17
GET_RANGE =
18
GET_BY_INDEX =
19
GET_BY_RANK =
21
GET_BY_VALUE =
22
GET_BY_VALUE_LIST =
23
GET_BY_INDEX_RANGE =
24
GET_BY_VALUE_INTERVAL =
25
GET_BY_RANK_RANGE =
26
GET_BY_VALUE_REL_RANK_RANGE =
27
REMOVE_BY_INDEX =
32
REMOVE_BY_RANK =
34
REMOVE_BY_VALUE =
35
REMOVE_BY_VALUE_LIST =
36
REMOVE_BY_INDEX_RANGE =
37
REMOVE_BY_VALUE_INTERVAL =
38
REMOVE_BY_RANK_RANGE =
39
REMOVE_BY_VALUE_REL_RANK_RANGE =
40

Constants inherited from Operation

Operation::ADD, Operation::BIT_MODIFY, Operation::BIT_READ, Operation::CDT_MODIFY, Operation::CDT_READ, Operation::DELETE, Operation::EXP_MODIFY, Operation::EXP_READ, Operation::HLL_MODIFY, Operation::HLL_READ, Operation::PREPEND, Operation::READ, Operation::READ_HEADER, Operation::TOUCH, Operation::WRITE

Instance Attribute Summary collapse

Attributes inherited from Operation

#bin_name, #op_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operation

add, #bin, delete, get_header, #is_write?, prepend, put, touch

Constructor Details

#initialize(op_type, list_op, bin_name, *arguments, return_type: nil, ctx: nil, flag: nil) ⇒ ListOperation

Returns a new instance of ListOperation.



89
90
91
92
93
94
95
96
97
98
# File 'lib/aerospike/cdt/list_operation.rb', line 89

def initialize(op_type, list_op, bin_name, *arguments, return_type: nil, ctx: nil, flag: nil)
  @op_type = op_type
  @bin_name = bin_name
  @bin_value = nil
  @list_op = list_op
  @ctx = ctx
  @flag = flag
  @arguments = arguments
  @return_type = return_type
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def arguments
  @arguments
end

#ctxObject (readonly)

Returns the value of attribute ctx.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def ctx
  @ctx
end

#flagObject (readonly)

Returns the value of attribute flag.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def flag
  @flag
end

#list_opObject (readonly)

Returns the value of attribute list_op.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def list_op
  @list_op
end

#policyObject (readonly)

Returns the value of attribute policy.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def policy
  @policy
end

#return_typeObject (readonly)

Returns the value of attribute return_type.



87
88
89
# File 'lib/aerospike/cdt/list_operation.rb', line 87

def return_type
  @return_type
end

Class Method Details

.append(bin_name, *values, ctx: nil, policy: ListPolicy::DEFAULT) ⇒ Object

Create list append operation.

Server appends value(s) to end of the list bin.
Server returns list size.


126
127
128
129
130
131
132
# File 'lib/aerospike/cdt/list_operation.rb', line 126

def self.append(bin_name, *values, ctx: nil, policy: ListPolicy::DEFAULT)
  if values.length > 1
    ListOperation.new(Operation::CDT_MODIFY, APPEND_ITEMS, bin_name, values, policy.order, policy.flags, ctx: ctx)
  else
    ListOperation.new(Operation::CDT_MODIFY, APPEND, bin_name, values.first, policy.order, policy.flags, ctx: ctx)
  end
end

.clear(bin_name, ctx: nil) ⇒ Object

Create list clear operation. Server removes all items in the list bin. Server does not return a result by default.



212
213
214
# File 'lib/aerospike/cdt/list_operation.rb', line 212

def self.clear(bin_name, ctx: nil)
  ListOperation.new(Operation::CDT_MODIFY, CLEAR, bin_name, ctx: ctx)
end

.create(bin_name, order, pad, ctx: nil) ⇒ Object

creates list create operation. Server creates list at given context level. The context is allowed to be beyond list boundaries only if pad is set to true. In that case, nil list entries will be inserted to satisfy the context position.



105
106
107
108
109
110
111
112
# File 'lib/aerospike/cdt/list_operation.rb', line 105

def self.create(bin_name, order, pad, ctx: nil)
  # If context not defined, the set order for top-level bin list.
  if !ctx || ctx.length == 0
    self.set_order(bin_name, order)
  else
    ListOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, order, ctx: ctx, flag: ListOrder.flag(order, pad))
  end
end

.get(bin_name, index, ctx: nil) ⇒ Object

Create list get operation. Server returns the item at the specified index in the list bin.



242
243
244
# File 'lib/aerospike/cdt/list_operation.rb', line 242

def self.get(bin_name, index, ctx: nil)
  ListOperation.new(Operation::CDT_READ, GET, bin_name, index, ctx: ctx)
end

.get_by_index(bin_name, index, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by index operation.

Server selects list item identified by index.

Server returns selected data specified by return_type.



264
265
266
# File 'lib/aerospike/cdt/list_operation.rb', line 264

def self.get_by_index(bin_name, index, ctx: nil, return_type: ListReturnType::NONE)
  ListOperation.new(Operation::CDT_READ, GET_BY_INDEX, bin_name, index, return_type: return_type, ctx: ctx)
end

.get_by_index_range(bin_name, index, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by index range operation.

Server selects list item identified by index range

Server returns selected data specified by return_type.



273
274
275
276
277
278
279
# File 'lib/aerospike/cdt/list_operation.rb', line 273

def self.get_by_index_range(bin_name, index, count=nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_INDEX_RANGE, bin_name, index, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_INDEX_RANGE, bin_name, index, ctx: ctx, return_type: return_type)
  end
end

.get_by_rank(bin_name, rank, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by rank operation.

Server selects list item identified by rank.

Server returns selected data specified by return_type.



286
287
288
# File 'lib/aerospike/cdt/list_operation.rb', line 286

def self.get_by_rank(bin_name, rank, ctx: nil, return_type: ListReturnType::NONE)
  ListOperation.new(Operation::CDT_READ, GET_BY_RANK, bin_name, rank, ctx: ctx, return_type: return_type)
end

.get_by_rank_range(bin_name, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by rank range operation.

Server selects list item identified by rank range.

Server returns selected data specified by return_type.



295
296
297
298
299
300
301
# File 'lib/aerospike/cdt/list_operation.rb', line 295

def self.get_by_rank_range(bin_name, rank, count=nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_RANK_RANGE, bin_name, rank, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_RANK_RANGE, bin_name, rank, ctx: ctx, return_type: return_type)
  end
end

.get_by_value(bin_name, value, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by value operation.

Server selects list items identified by value.

Server returns selected data specified by return_type.



308
309
310
# File 'lib/aerospike/cdt/list_operation.rb', line 308

def self.get_by_value(bin_name, value, ctx: nil, return_type: ListReturnType::NONE)
  InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE, bin_name, value, ctx: ctx, return_type: return_type)
end

.get_by_value_list(bin_name, values, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by value list operation.

Server selects list items identified by values.

Server returns selected data specified by return_type.



333
334
335
# File 'lib/aerospike/cdt/list_operation.rb', line 333

def self.get_by_value_list(bin_name, values, ctx: nil, return_type: ListReturnType::NONE)
  InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_LIST, bin_name, values, ctx: ctx, return_type: return_type)
end

.get_by_value_range(bin_name, value_begin, value_end = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by value range operation.

Server selects list items identified by value range (value_begin inclusive, value_end exclusive). If value_begin is null, the range is less than value_end. If value_end is null, the range is greater than equal to value_begin.

Server returns selected data specified by return_type.



320
321
322
323
324
325
326
# File 'lib/aerospike/cdt/list_operation.rb', line 320

def self.get_by_value_range(bin_name, value_begin, value_end = nil, ctx: nil, return_type: ListReturnType::NONE)
  if value_end
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_INTERVAL, bin_name, value_begin, value_end, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_INTERVAL, bin_name, value_begin, ctx: ctx, return_type: return_type)
  end
end

.get_by_value_rel_rank_range(bin_name, value, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list get by value relative to rank range list operation.

Server selects list items nearest to value and greater, by relative rank with a count limit.

Server returns selected data specified by return_type.

Examples for ordered list [0, 4, 5, 9, 11, 15]: <ul> <li>(value, rank, count) = [selected items]</li> <li>(5, 0, 2) = [5, 9]</li> <li>(5, 1, 1) = [9]</li> <li>(5, -1, 2) = [4, 5]</li> <li>(3, 0, 1) = [4]</li> <li>(3, 3, 7) = [11, 15]</li> <li>(3, -3, 2) = []</li> </ul>

Without count:

Examples for ordered list [0, 4, 5, 9, 11, 15]: <ul> <li>(value, rank) = [selected items]</li> <li>(5, 0) = [5, 9, 11, 15]</li> <li>(5, 1) = [9, 11, 15]</li> <li>(5, -1) = [4, 5, 9, 11, 15]</li> <li>(3, 0) = [4, 5, 9, 11, 15]</li> <li>(3, 3) = [11, 15]</li> <li>(3, -3) = [0, 4, 5, 9, 11, 15]</li> </ul>



367
368
369
370
371
372
373
# File 'lib/aerospike/cdt/list_operation.rb', line 367

def self.get_by_value_rel_rank_range(bin_name, value, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, ctx: ctx, return_type: return_type)
  end
end

.get_range(bin_name, index, count = nil, ctx: nil) ⇒ Object

Create list get range operation. Server returns “count” items starting at the specified index in the list bin. If “count” is not specified, the server returns all items starting at the specified index to the end of the list.



251
252
253
254
255
256
257
# File 'lib/aerospike/cdt/list_operation.rb', line 251

def self.get_range(bin_name, index, count=nil, ctx: nil)
  if count
    ListOperation.new(Operation::CDT_READ, GET_RANGE, bin_name, index, count, ctx: ctx)
  else
    ListOperation.new(Operation::CDT_READ, GET_RANGE, bin_name, index, ctx: ctx)
  end
end

.increment(bin_name, index, value = 1, ctx: nil, policy: ListPolicy::DEFAULT) ⇒ Object

Create list increment operation. Server increments list by value. If not specified, value defaults to 1. Server returns the value of list after the operation.



220
221
222
# File 'lib/aerospike/cdt/list_operation.rb', line 220

def self.increment(bin_name, index, value = 1, ctx: nil, policy: ListPolicy::DEFAULT)
  ListOperation.new(Operation::CDT_MODIFY, INCREMENT, bin_name, index, value, policy.order, policy.flags, ctx: ctx)
end

.insert(bin_name, index, *values, ctx: nil, policy: ListPolicy::DEFAULT) ⇒ Object

Create list insert operation.

Server inserts value(s) at the specified index of the list bin.
Server returns list size.


138
139
140
141
142
143
144
# File 'lib/aerospike/cdt/list_operation.rb', line 138

def self.insert(bin_name, index, *values, ctx: nil, policy: ListPolicy::DEFAULT)
  if values.length > 1
    ListOperation.new(Operation::CDT_MODIFY, INSERT_ITEMS, bin_name, index, values, policy.flags, ctx: ctx)
  else
    ListOperation.new(Operation::CDT_MODIFY, INSERT, bin_name, index, values.first, policy.flags, ctx: ctx)
  end
end

.pop(bin_name, index, ctx: nil) ⇒ Object

Create list pop operation. Server returns item at specified index and removes item from list bin.



149
150
151
# File 'lib/aerospike/cdt/list_operation.rb', line 149

def self.pop(bin_name, index, ctx: nil)
  ListOperation.new(Operation::CDT_MODIFY, POP, bin_name, index, ctx: ctx)
end

.pop_range(bin_name, index, count = nil, ctx: nil) ⇒ Object

Create list pop range operation. Server returns “count” items starting at specified index and removes items from list bin. If “count” is not specified, the server returns items starting at the specified index to the end of the list and removes those items from the list bin.



159
160
161
162
163
164
165
# File 'lib/aerospike/cdt/list_operation.rb', line 159

def self.pop_range(bin_name, index, count=nil, ctx: nil)
  if count
    ListOperation.new(Operation::CDT_MODIFY, POP_RANGE, bin_name, index, count, ctx: ctx)
  else
    ListOperation.new(Operation::CDT_MODIFY, POP_RANGE, bin_name, index, ctx: ctx)
  end
end

.remove(bin_name, index, ctx: nil) ⇒ Object

Create list remove operation. Server removes item at specified index from list bin. Server returns number of items removed.



171
172
173
# File 'lib/aerospike/cdt/list_operation.rb', line 171

def self.remove(bin_name, index, ctx: nil)
  ListOperation.new(Operation::CDT_MODIFY, REMOVE, bin_name, index, ctx: ctx)
end

.remove_by_index(bin_name, index, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by index operation.

Server removes list item identified by index.

Server returns selected data specified by return_type.



380
381
382
# File 'lib/aerospike/cdt/list_operation.rb', line 380

def self.remove_by_index(bin_name, index, ctx: nil, return_type: ListReturnType::NONE)
  ListOperation.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX, bin_name, index, ctx: ctx, return_type: return_type)
end

.remove_by_index_range(bin_name, index, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by index range operation.

Server removes list item identified by index range

Server returns selected data specified by return_type.



389
390
391
392
393
394
395
# File 'lib/aerospike/cdt/list_operation.rb', line 389

def self.remove_by_index_range(bin_name, index, count=nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX_RANGE, bin_name, index, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX_RANGE, bin_name, index, ctx: ctx, return_type: return_type)
  end
end

.remove_by_rank(bin_name, rank, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by rank operation.

Server removes list item identified by rank.

Server returns selected data specified by return_type.



402
403
404
# File 'lib/aerospike/cdt/list_operation.rb', line 402

def self.remove_by_rank(bin_name, rank, ctx: nil, return_type: ListReturnType::NONE)
  ListOperation.new(Operation::CDT_MODIFY, REMOVE_BY_RANK, bin_name, rank, ctx: ctx, return_type: return_type)
end

.remove_by_rank_range(bin_name, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by rank range operation.

Server removes list item identified by rank range.

Server returns selected data specified by return_type.



411
412
413
414
415
416
417
# File 'lib/aerospike/cdt/list_operation.rb', line 411

def self.remove_by_rank_range(bin_name, rank, count=nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_RANK_RANGE, bin_name, rank, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_RANK_RANGE, bin_name, rank, ctx: ctx, return_type: return_type)
  end
end

.remove_by_value(bin_name, value, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by value operation.

Server removes list items identified by value.

Server returns selected data specified by return_type.



424
425
426
# File 'lib/aerospike/cdt/list_operation.rb', line 424

def self.remove_by_value(bin_name, value, ctx: nil, return_type: ListReturnType::NONE)
  InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE, bin_name, value, ctx: ctx, return_type: return_type)
end

.remove_by_value_list(bin_name, values, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by value list operation.

Server removes list items identified by values.

Server returns selected data specified by return_type.



449
450
451
# File 'lib/aerospike/cdt/list_operation.rb', line 449

def self.remove_by_value_list(bin_name, values, ctx: nil, return_type: ListReturnType::NONE)
  InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_LIST, bin_name, values, ctx: ctx, return_type: return_type)
end

.remove_by_value_range(bin_name, value_begin, value_end = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by value range operation.

Server removes list items identified by value range (value_begin inclusive, value_end exclusive). If value_begin is null, the range is less than value_end. If value_end is null, the range is greater than equal to value_begin.

Server returns selected data specified by return_type.



436
437
438
439
440
441
442
# File 'lib/aerospike/cdt/list_operation.rb', line 436

def self.remove_by_value_range(bin_name, value_begin, value_end = nil, ctx: nil, return_type: ListReturnType::NONE)
  if value_end
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_INTERVAL, bin_name, value_begin, value_end, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_INTERVAL, bin_name, value_begin, ctx: ctx, return_type: return_type)
  end
end

.remove_by_value_rel_rank_range(bin_name, value, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE) ⇒ Object

Create list remove by value relative to rank range list operation.

Server removes list items nearest to value and greater, by relative rank with a count limit.

Server returns selected data specified by return_type.

Examples for ordered list [0, 4, 5, 9, 11, 15]: <ul> <li>(value, rank, count) = [selected items]</li> <li>(5, 0, 2) = [5, 9]</li> <li>(5, 1, 1) = [9]</li> <li>(5, -1, 2) = [4, 5]</li> <li>(3, 0, 1) = [4]</li> <li>(3, 3, 7) = [11, 15]</li> <li>(3, -3, 2) = []</li> </ul>

Without count:

Examples for ordered list [0, 4, 5, 9, 11, 15]: <ul> <li>(value, rank) = [selected items]</li> <li>(5, 0) = [5, 9, 11, 15]</li> <li>(5, 1) = [9, 11, 15]</li> <li>(5, -1) = [4, 5, 9, 11, 15]</li> <li>(3, 0) = [4, 5, 9, 11, 15]</li> <li>(3, 3) = [11, 15]</li> <li>(3, -3) = [0, 4, 5, 9, 11, 15]</li> </ul>



483
484
485
486
487
488
489
# File 'lib/aerospike/cdt/list_operation.rb', line 483

def self.remove_by_value_rel_rank_range(bin_name, value, rank, count = nil, ctx: nil, return_type: ListReturnType::NONE)
  if count
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, count, ctx: ctx, return_type: return_type)
  else
    InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, ctx: ctx, return_type: return_type)
  end
end

.remove_range(bin_name, index, count = nil, ctx: nil) ⇒ Object

Create list remove range operation. Server removes “count” items at specified index from list bin. If “count” is not specified, the server removes all items starting at the specified index to the end of the list. Server returns number of items removed.



181
182
183
184
185
186
187
# File 'lib/aerospike/cdt/list_operation.rb', line 181

def self.remove_range(bin_name, index, count=nil, ctx: nil)
  if count
    ListOperation.new(Operation::CDT_MODIFY, REMOVE_RANGE, bin_name, index, count, ctx: ctx)
  else
    ListOperation.new(Operation::CDT_MODIFY, REMOVE_RANGE, bin_name, index, ctx: ctx)
  end
end

.set(bin_name, index, value, ctx: nil, policy: ListPolicy::DEFAULT) ⇒ Object

Create list set operation. Server sets item value at specified index in list bin. Server does not return a result by default.



193
194
195
# File 'lib/aerospike/cdt/list_operation.rb', line 193

def self.set(bin_name, index, value, ctx: nil, policy: ListPolicy::DEFAULT)
  ListOperation.new(Operation::CDT_MODIFY, SET, bin_name, index, value, policy.flags, ctx: ctx)
end

.set_order(bin_name, order, ctx: nil) ⇒ Object

Create a set list order operation.

Server sets list order.
Server returns null.


118
119
120
# File 'lib/aerospike/cdt/list_operation.rb', line 118

def self.set_order(bin_name, order, ctx: nil)
  ListOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, order, ctx: ctx)
end

.size(bin_name, ctx: nil) ⇒ Object

Create list size operation. Server returns size of list.



235
236
237
# File 'lib/aerospike/cdt/list_operation.rb', line 235

def self.size(bin_name, ctx: nil)
  ListOperation.new(Operation::CDT_READ, SIZE, bin_name, ctx: ctx)
end

.sort(bin_name, sort_flags = ListSortFlags::DEFAULT) ⇒ Object

Create list sort operation. Server sorts list according to sort_flags. Server does not return a result by default.



228
229
230
# File 'lib/aerospike/cdt/list_operation.rb', line 228

def self.sort(bin_name, sort_flags = ListSortFlags::DEFAULT)
  ListOperation.new(Operation::CDT_MODIFY, SORT, bin_name, sort_flags)
end

.trim(bin_name, index, count, ctx: nil) ⇒ Object

Create list trim operation.

Server removes items in list bin that do not fall into range specified by index and count.

Server returns number of items removed.



204
205
206
# File 'lib/aerospike/cdt/list_operation.rb', line 204

def self.trim(bin_name, index, count, ctx: nil)
  ListOperation.new(Operation::CDT_MODIFY, TRIM, bin_name, index, count, ctx: ctx)
end

Instance Method Details

#and_return(return_type) ⇒ Object



491
492
493
494
495
# File 'lib/aerospike/cdt/list_operation.rb', line 491

def and_return(return_type)
  @return_type = return_type
  @bin_value = nil
  self
end

#bin_valueObject



501
502
503
# File 'lib/aerospike/cdt/list_operation.rb', line 501

def bin_value
  @bin_value ||= pack_bin_value
end

#invert_selection?Boolean

Returns:

  • (Boolean)


497
498
499
# File 'lib/aerospike/cdt/list_operation.rb', line 497

def invert_selection?
  false
end