Class: Aerospike::CDT::ListOperation
- Defined in:
- lib/aerospike/cdt/list_operation.rb
Overview
List bin operations. Create list operations used by the Client#operate command. List operations support negative indexing. If the index is negative, the resolved index starts backwards from end of list.
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.
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.
Direct Known Subclasses
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::CDT_MODIFY, Operation::CDT_READ, Operation::DELETE, Operation::PREPEND, Operation::READ, Operation::READ_HEADER, Operation::TOUCH, Operation::WRITE
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#list_op ⇒ Object
readonly
Returns the value of attribute list_op.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Attributes inherited from Operation
Class Method Summary collapse
-
.append(bin_name, *values, policy: ListPolicy::DEFAULT) ⇒ Object
Create list append operation.
-
.clear(bin_name) ⇒ Object
Create list clear operation.
-
.get(bin_name, index) ⇒ Object
Create list get operation.
-
.get_by_index(bin_name, index, return_type: ListReturnType::NONE) ⇒ Object
Create list get by index operation.
-
.get_by_index_range(bin_name, index, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list get by index range operation.
-
.get_by_rank(bin_name, rank, return_type: ListReturnType::NONE) ⇒ Object
Create list get by rank operation.
-
.get_by_rank_range(bin_name, rank, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list get by rank range operation.
-
.get_by_value(bin_name, value, return_type: ListReturnType::NONE) ⇒ Object
Create list get by value operation.
-
.get_by_value_list(bin_name, values, return_type: ListReturnType::NONE) ⇒ Object
Create list get by value list operation.
-
.get_by_value_range(bin_name, value_begin, value_end = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list get by value range operation.
-
.get_by_value_rel_rank_range(bin_name, value, rank, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list get by value relative to rank range list operation.
-
.get_range(bin_name, index, count = nil) ⇒ Object
Create list get range operation.
-
.increment(bin_name, index, value = 1, policy: ListPolicy::DEFAULT) ⇒ Object
Create list increment operation.
-
.insert(bin_name, index, *values, policy: ListPolicy::DEFAULT) ⇒ Object
Create list insert operation.
-
.pop(bin_name, index) ⇒ Object
Create list pop operation.
-
.pop_range(bin_name, index, count = nil) ⇒ Object
Create list pop range operation.
-
.remove(bin_name, index) ⇒ Object
Create list remove operation.
-
.remove_by_index(bin_name, index, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by index operation.
-
.remove_by_index_range(bin_name, index, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by index range operation.
-
.remove_by_rank(bin_name, rank, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by rank operation.
-
.remove_by_rank_range(bin_name, rank, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by rank range operation.
-
.remove_by_value(bin_name, value, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by value operation.
-
.remove_by_value_list(bin_name, values, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by value list operation.
-
.remove_by_value_range(bin_name, value_begin, value_end = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by value range operation.
-
.remove_by_value_rel_rank_range(bin_name, value, rank, count = nil, return_type: ListReturnType::NONE) ⇒ Object
Create list remove by value relative to rank range list operation.
-
.remove_range(bin_name, index, count = nil) ⇒ Object
Create list remove range operation.
-
.set(bin_name, index, value, policy: ListPolicy::DEFAULT) ⇒ Object
Create list set operation.
-
.set_order(bin_name, order) ⇒ Object
Create a set list order operation.
-
.size(bin_name) ⇒ Object
Create list size operation.
-
.sort(bin_name, sort_flags = ListSortFlags::DEFAULT) ⇒ Object
Create list sort operation.
-
.trim(bin_name, index, count) ⇒ Object
Create list trim operation.
Instance Method Summary collapse
- #and_return(return_type) ⇒ Object
- #bin_value ⇒ Object
-
#initialize(op_type, list_op, bin_name, *arguments, return_type: nil) ⇒ ListOperation
constructor
A new instance of ListOperation.
- #invert_selection? ⇒ Boolean
Methods inherited from Operation
add, #bin, delete, get_header, prepend, put, touch
Constructor Details
#initialize(op_type, list_op, bin_name, *arguments, return_type: nil) ⇒ ListOperation
Returns a new instance of ListOperation.
80 81 82 83 84 85 86 87 |
# File 'lib/aerospike/cdt/list_operation.rb', line 80 def initialize(op_type, list_op, bin_name, *arguments, return_type: nil) @op_type = op_type @bin_name = bin_name @bin_value = nil @list_op = list_op @arguments = arguments @return_type = return_type end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
78 79 80 |
# File 'lib/aerospike/cdt/list_operation.rb', line 78 def arguments @arguments end |
#list_op ⇒ Object (readonly)
Returns the value of attribute list_op.
78 79 80 |
# File 'lib/aerospike/cdt/list_operation.rb', line 78 def list_op @list_op end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
78 79 80 |
# File 'lib/aerospike/cdt/list_operation.rb', line 78 def policy @policy end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
78 79 80 |
# File 'lib/aerospike/cdt/list_operation.rb', line 78 def return_type @return_type end |
Class Method Details
.append(bin_name, *values, policy: ListPolicy::DEFAULT) ⇒ Object
Create list append operation.
Server appends value(s) to end of the list bin.
Server returns list size.
101 102 103 104 105 106 107 |
# File 'lib/aerospike/cdt/list_operation.rb', line 101 def self.append(bin_name, *values, policy: ListPolicy::DEFAULT) if values.length > 1 ListOperation.new(Operation::CDT_MODIFY, APPEND_ITEMS, bin_name, values, policy.order, policy.flags) else ListOperation.new(Operation::CDT_MODIFY, APPEND, bin_name, values.first, policy.order, policy.flags) end end |
.clear(bin_name) ⇒ Object
Create list clear operation. Server removes all items in the list bin. Server does not return a result by default.
187 188 189 |
# File 'lib/aerospike/cdt/list_operation.rb', line 187 def self.clear(bin_name) ListOperation.new(Operation::CDT_MODIFY, CLEAR, bin_name) end |
.get(bin_name, index) ⇒ Object
Create list get operation. Server returns the item at the specified index in the list bin.
217 218 219 |
# File 'lib/aerospike/cdt/list_operation.rb', line 217 def self.get(bin_name, index) ListOperation.new(Operation::CDT_READ, GET, bin_name, index) end |
.get_by_index(bin_name, index, 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.
239 240 241 |
# File 'lib/aerospike/cdt/list_operation.rb', line 239 def self.get_by_index(bin_name, index, return_type: ListReturnType::NONE) ListOperation.new(Operation::CDT_READ, GET_BY_INDEX, bin_name, index, return_type: return_type) end |
.get_by_index_range(bin_name, index, count = 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.
248 249 250 251 252 253 254 |
# File 'lib/aerospike/cdt/list_operation.rb', line 248 def self.get_by_index_range(bin_name, index, count=nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_READ, GET_BY_INDEX_RANGE, bin_name, index, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_READ, GET_BY_INDEX_RANGE, bin_name, index, return_type: return_type) end end |
.get_by_rank(bin_name, rank, 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.
261 262 263 |
# File 'lib/aerospike/cdt/list_operation.rb', line 261 def self.get_by_rank(bin_name, rank, return_type: ListReturnType::NONE) ListOperation.new(Operation::CDT_READ, GET_BY_RANK, bin_name, rank, return_type: return_type) end |
.get_by_rank_range(bin_name, rank, count = 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.
270 271 272 273 274 275 276 |
# File 'lib/aerospike/cdt/list_operation.rb', line 270 def self.get_by_rank_range(bin_name, rank, count=nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_READ, GET_BY_RANK_RANGE, bin_name, rank, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_READ, GET_BY_RANK_RANGE, bin_name, rank, return_type: return_type) end end |
.get_by_value(bin_name, value, 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.
283 284 285 |
# File 'lib/aerospike/cdt/list_operation.rb', line 283 def self.get_by_value(bin_name, value, return_type: ListReturnType::NONE) InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE, bin_name, value, return_type: return_type) end |
.get_by_value_list(bin_name, values, 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.
308 309 310 |
# File 'lib/aerospike/cdt/list_operation.rb', line 308 def self.get_by_value_list(bin_name, values, return_type: ListReturnType::NONE) InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_LIST, bin_name, values, return_type: return_type) end |
.get_by_value_range(bin_name, value_begin, value_end = 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.
295 296 297 298 299 300 301 |
# File 'lib/aerospike/cdt/list_operation.rb', line 295 def self.get_by_value_range(bin_name, value_begin, value_end = nil, return_type: ListReturnType::NONE) if value_end InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_INTERVAL, bin_name, value_begin, value_end, return_type: return_type) else InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_INTERVAL, bin_name, value_begin, return_type: return_type) end end |
.get_by_value_rel_rank_range(bin_name, value, rank, count = 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>
342 343 344 345 346 347 348 |
# File 'lib/aerospike/cdt/list_operation.rb', line 342 def self.get_by_value_rel_rank_range(bin_name, value, rank, count = nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_READ, GET_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, return_type: return_type) end end |
.get_range(bin_name, index, count = 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.
226 227 228 229 230 231 232 |
# File 'lib/aerospike/cdt/list_operation.rb', line 226 def self.get_range(bin_name, index, count=nil) if count ListOperation.new(Operation::CDT_READ, GET_RANGE, bin_name, index, count) else ListOperation.new(Operation::CDT_READ, GET_RANGE, bin_name, index) end end |
.increment(bin_name, index, value = 1, policy: ListPolicy::DEFAULT) ⇒ Object
195 196 197 |
# File 'lib/aerospike/cdt/list_operation.rb', line 195 def self.increment(bin_name, index, value = 1, policy: ListPolicy::DEFAULT) ListOperation.new(Operation::CDT_MODIFY, INCREMENT, bin_name, index, value, policy.order, policy.flags) end |
.insert(bin_name, index, *values, policy: ListPolicy::DEFAULT) ⇒ Object
Create list insert operation.
Server inserts value(s) at the specified index of the list bin.
Server returns list size.
113 114 115 116 117 118 119 |
# File 'lib/aerospike/cdt/list_operation.rb', line 113 def self.insert(bin_name, index, *values, policy: ListPolicy::DEFAULT) if values.length > 1 ListOperation.new(Operation::CDT_MODIFY, INSERT_ITEMS, bin_name, index, values, policy.flags) else ListOperation.new(Operation::CDT_MODIFY, INSERT, bin_name, index, values.first, policy.flags) end end |
.pop(bin_name, index) ⇒ Object
Create list pop operation. Server returns item at specified index and removes item from list bin.
124 125 126 |
# File 'lib/aerospike/cdt/list_operation.rb', line 124 def self.pop(bin_name, index) ListOperation.new(Operation::CDT_MODIFY, POP, bin_name, index) end |
.pop_range(bin_name, index, count = 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.
134 135 136 137 138 139 140 |
# File 'lib/aerospike/cdt/list_operation.rb', line 134 def self.pop_range(bin_name, index, count=nil) if count ListOperation.new(Operation::CDT_MODIFY, POP_RANGE, bin_name, index, count) else ListOperation.new(Operation::CDT_MODIFY, POP_RANGE, bin_name, index) end end |
.remove(bin_name, index) ⇒ Object
Create list remove operation. Server removes item at specified index from list bin. Server returns number of items removed.
146 147 148 |
# File 'lib/aerospike/cdt/list_operation.rb', line 146 def self.remove(bin_name, index) ListOperation.new(Operation::CDT_MODIFY, REMOVE, bin_name, index) end |
.remove_by_index(bin_name, index, 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.
355 356 357 |
# File 'lib/aerospike/cdt/list_operation.rb', line 355 def self.remove_by_index(bin_name, index, return_type: ListReturnType::NONE) ListOperation.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX, bin_name, index, return_type: return_type) end |
.remove_by_index_range(bin_name, index, count = 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.
364 365 366 367 368 369 370 |
# File 'lib/aerospike/cdt/list_operation.rb', line 364 def self.remove_by_index_range(bin_name, index, count=nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX_RANGE, bin_name, index, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_INDEX_RANGE, bin_name, index, return_type: return_type) end end |
.remove_by_rank(bin_name, rank, 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.
377 378 379 |
# File 'lib/aerospike/cdt/list_operation.rb', line 377 def self.remove_by_rank(bin_name, rank, return_type: ListReturnType::NONE) ListOperation.new(Operation::CDT_MODIFY, REMOVE_BY_RANK, bin_name, rank, return_type: return_type) end |
.remove_by_rank_range(bin_name, rank, count = 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.
386 387 388 389 390 391 392 |
# File 'lib/aerospike/cdt/list_operation.rb', line 386 def self.remove_by_rank_range(bin_name, rank, count=nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_RANK_RANGE, bin_name, rank, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_RANK_RANGE, bin_name, rank, return_type: return_type) end end |
.remove_by_value(bin_name, value, 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.
399 400 401 |
# File 'lib/aerospike/cdt/list_operation.rb', line 399 def self.remove_by_value(bin_name, value, return_type: ListReturnType::NONE) InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE, bin_name, value, return_type: return_type) end |
.remove_by_value_list(bin_name, values, 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.
424 425 426 |
# File 'lib/aerospike/cdt/list_operation.rb', line 424 def self.remove_by_value_list(bin_name, values, return_type: ListReturnType::NONE) InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_LIST, bin_name, values, return_type: return_type) end |
.remove_by_value_range(bin_name, value_begin, value_end = 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.
411 412 413 414 415 416 417 |
# File 'lib/aerospike/cdt/list_operation.rb', line 411 def self.remove_by_value_range(bin_name, value_begin, value_end = nil, return_type: ListReturnType::NONE) if value_end InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_INTERVAL, bin_name, value_begin, value_end, return_type: return_type) else InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_INTERVAL, bin_name, value_begin, return_type: return_type) end end |
.remove_by_value_rel_rank_range(bin_name, value, rank, count = 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>
458 459 460 461 462 463 464 |
# File 'lib/aerospike/cdt/list_operation.rb', line 458 def self.remove_by_value_rel_rank_range(bin_name, value, rank, count = nil, return_type: ListReturnType::NONE) if count InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, count, return_type: return_type) else InvertibleListOp.new(Operation::CDT_MODIFY, REMOVE_BY_VALUE_REL_RANK_RANGE, bin_name, value, rank, return_type: return_type) end end |
.remove_range(bin_name, index, count = 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.
156 157 158 159 160 161 162 |
# File 'lib/aerospike/cdt/list_operation.rb', line 156 def self.remove_range(bin_name, index, count=nil) if count ListOperation.new(Operation::CDT_MODIFY, REMOVE_RANGE, bin_name, index, count) else ListOperation.new(Operation::CDT_MODIFY, REMOVE_RANGE, bin_name, index) end end |
.set(bin_name, index, value, 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.
168 169 170 |
# File 'lib/aerospike/cdt/list_operation.rb', line 168 def self.set(bin_name, index, value, policy: ListPolicy::DEFAULT) ListOperation.new(Operation::CDT_MODIFY, SET, bin_name, index, value, policy.flags) end |
.set_order(bin_name, order) ⇒ Object
Create a set list order operation.
Server sets list order.
Server returns null.
93 94 95 |
# File 'lib/aerospike/cdt/list_operation.rb', line 93 def self.set_order(bin_name, order) ListOperation.new(Operation::CDT_MODIFY, SET_TYPE, bin_name, order) end |
.size(bin_name) ⇒ Object
Create list size operation. Server returns size of list.
210 211 212 |
# File 'lib/aerospike/cdt/list_operation.rb', line 210 def self.size(bin_name) ListOperation.new(Operation::CDT_READ, SIZE, bin_name) 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.
203 204 205 |
# File 'lib/aerospike/cdt/list_operation.rb', line 203 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) ⇒ 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.
179 180 181 |
# File 'lib/aerospike/cdt/list_operation.rb', line 179 def self.trim(bin_name, index, count) ListOperation.new(Operation::CDT_MODIFY, TRIM, bin_name, index, count) end |
Instance Method Details
#and_return(return_type) ⇒ Object
466 467 468 469 470 |
# File 'lib/aerospike/cdt/list_operation.rb', line 466 def and_return(return_type) @return_type = return_type @bin_value = nil self end |
#bin_value ⇒ Object
476 477 478 |
# File 'lib/aerospike/cdt/list_operation.rb', line 476 def bin_value @bin_value ||= pack_bin_value end |
#invert_selection? ⇒ Boolean
472 473 474 |
# File 'lib/aerospike/cdt/list_operation.rb', line 472 def invert_selection? false end |