Package com.aerospike.client.cdt
Class ListOperation
java.lang.Object
com.aerospike.client.cdt.ListOperation
List bin operations. Create list operations used by client operate command.
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 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],[1,2,3],[6,5,4,1]]
- Append 11 to last list.
- ListOperation.append("bin", Value.get(11), CTX.listIndex(-1))
- bin result = [[7,9,5],[1,2,3],[6,5,4,1,11]]
- bin = {key1=[[7,9,5],[13]], key2=[[9],[2,4],[6,1,9]], key3=[[6,5]]}
- Append 11 to lowest ranked list in map identified by "key2".
- ListOperation.append("bin", Value.get(11), CTX.mapKey(Value.get("key2")), CTX.listRank(0))
- bin result = {key1=[[7,9,5],[13]], key2=[[9],[2,4,11],[6,1,9]], key3=[[6,5]]}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Operationappend(ListPolicy policy, String binName, Value value, CTX... ctx) Create list append operation with policy.static OperationCreate default list append operation.static OperationappendItems(ListPolicy policy, String binName, List<Value> list, CTX... ctx) Create list append items operation with policy.static OperationappendItems(String binName, List<Value> list, CTX... ctx) Create default list append items operation.static OperationCreate list clear operation.static OperationCreate list create operation.static OperationCreate list create operation.static OperationCreate list get operation.static OperationgetByIndex(String binName, int index, int returnType, CTX... ctx) Create list get by index operation.static OperationgetByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create list get by index range operation.static OperationgetByIndexRange(String binName, int index, int returnType, CTX... ctx) Create list get by index range operation.static OperationCreate list get by rank operation.static OperationgetByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create list get by rank range operation.static OperationgetByRankRange(String binName, int rank, int returnType, CTX... ctx) Create list get by rank range operation.static OperationgetByValue(String binName, Value value, int returnType, CTX... ctx) Create list get by value operation.static OperationgetByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create list get by value list operation.static OperationgetByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create list get by value range operation.static OperationgetByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create list get by value relative to rank range operation.static OperationgetByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create list get by value relative to rank range operation.static OperationCreate list get range operation.static OperationCreate list get range operation.static Operationincrement(ListPolicy policy, String binName, int index, CTX... ctx) Create list increment operation with policy.static Operationincrement(ListPolicy policy, String binName, int index, Value value, CTX... ctx) Create list increment operation.static OperationCreate default list increment operation.static OperationCreate default list increment operation.static Operationinsert(ListPolicy policy, String binName, int index, Value value, CTX... ctx) Create list insert operation with policy.static OperationCreate default list insert operation.static OperationinsertItems(ListPolicy policy, String binName, int index, List<Value> list, CTX... ctx) Create list insert items operation with policy.static OperationinsertItems(String binName, int index, List<Value> list, CTX... ctx) Create default list insert items operation.static OperationCreate list pop operation.static OperationCreate list pop range operation.static OperationCreate list pop range operation.static OperationCreate list remove operation.static OperationremoveByIndex(String binName, int index, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByIndexRange(String binName, int index, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByRank(String binName, int rank, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByRankRange(String binName, int rank, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByValue(String binName, Value value, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create list remove operation.static OperationremoveByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create list remove by value relative to rank range operation.static OperationremoveByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create list remove by value relative to rank range operation.static OperationremoveRange(String binName, int index, int count, CTX... ctx) Create list remove range operation.static OperationremoveRange(String binName, int index, CTX... ctx) Create list remove range operation.static Operationset(ListPolicy policy, String binName, int index, Value value, CTX... ctx) Create list set operation with policy.static OperationCreate list set operation.static OperationCreate set list order operation.static OperationCreate set list order operation.static OperationCreate list size operation.static OperationCreate list sort operation.static OperationCreate list trim operation.
-
Constructor Details
-
ListOperation
public ListOperation()
-
-
Method Details
-
create
Create list create operation. Server creates list at given context level.- Parameters:
binName- bin nameorder- list orderpad- if true, context is allowed to be beyond list boundaries and insert nil list entries to satisfy the ctx positionctx- optional path to nested list. If not defined, the top-level list is used.
-
create
public static Operation create(String binName, ListOrder order, boolean pad, boolean persistIndex, CTX... ctx) Create list create operation. Server creates list at given context level.- Parameters:
binName- bin nameorder- list orderpad- if true, context is allowed to be beyond list boundaries and insert nil list entries to satisfy the ctx positionpersistIndex- if true, persist list index. A list index improves lookup performance, but requires more storage. A list index can be created for a top-level ordered list only. Nested and unordered list indexes are not supported.ctx- optional path to nested list. If not defined, the top-level list is used.
-
setOrder
Create set list order operation. Server sets list order. Server returns null. -
setOrder
Create set list order operation. Server sets list order. Server returns null.- Parameters:
binName- bin nameorder- list orderpersistIndex- if true, persist list index. A list index improves lookup performance, but requires more storage. A list index can be created for a top-level ordered list only. Nested and unordered list indexes are not supported.ctx- optional path to nested list. If not defined, the top-level list is used.
-
append
Create default list append operation. Server appends value to end of list bin. Server returns list size. -
append
Create list append operation with policy. Server appends value to list bin. Server returns list size. -
appendItems
Create default list append items operation. Server appends each input list item to end of list bin. Server returns list size. -
appendItems
public static Operation appendItems(ListPolicy policy, String binName, List<Value> list, CTX... ctx) Create list append items operation with policy. Server appends each input list item to list bin. Server returns list size. -
insert
Create default list insert operation. Server inserts value to specified index of list bin. Server returns list size. -
insert
public static Operation insert(ListPolicy policy, String binName, int index, Value value, CTX... ctx) Create list insert operation with policy. Server inserts value to specified index of list bin. Server returns list size. -
insertItems
Create default list insert items operation. Server inserts each input list item starting at specified index of list bin. Server returns list size. -
insertItems
public static Operation insertItems(ListPolicy policy, String binName, int index, List<Value> list, CTX... ctx) Create list insert items operation with policy. Server inserts each input list item starting at specified index of list bin. Server returns list size. -
increment
Create default list increment operation. Server increments list[index] by 1. Server returns list[index] after incrementing. -
increment
Create list increment operation with policy. Server increments list[index] by 1. Server returns list[index] after incrementing. -
increment
Create default list increment operation. Server increments list[index] by value. Value should be integer(IntegerValue, LongValue) or double(DoubleValue, FloatValue). Server returns list[index] after incrementing. -
increment
public static Operation increment(ListPolicy policy, String binName, int index, Value value, CTX... ctx) Create list increment operation. Server increments list[index] by value. Value should be integer(IntegerValue, LongValue) or double(DoubleValue, FloatValue). Server returns list[index] after incrementing. -
pop
Create list pop operation. Server returns item at specified index and removes item from list bin. -
popRange
Create list pop range operation. Server returns "count" items starting at specified index and removes items from list bin. -
popRange
Create list pop range operation. Server returns items starting at specified index to the end of list and removes those items from list bin. -
remove
Create list remove operation. Server removes item at specified index from list bin. Server returns number of items removed. -
removeRange
Create list remove range operation. Server removes "count" items starting at specified index from list bin. Server returns number of items removed. -
removeRange
Create list remove range operation. Server removes items starting at specified index to the end of list. Server returns number of items removed. -
set
Create list set operation. Server sets item value at specified index in list bin. Server does not return a result by default. -
set
Create list set operation with policy. Server sets item value at specified index in list bin. Server does not return a result by default. -
trim
Create list trim operation. Server removes items in list bin that do not fall into range specified by index and count range. If the range is out of bounds, then all items will be removed. Server returns list size after trim. -
clear
Create list clear operation. Server removes all items in list bin. Server does not return a result by default. -
sort
Create list sort operation. Server sorts list according to sortFlags. Server does not return a result by default.- Parameters:
binName- server bin namesortFlags- sort flags. SeeListSortFlags.ctx- optional context path for nested CDT
-
removeByValue
Create list remove operation. Server removes list items identified by value and returns removed data specified by returnType (SeeListReturnType). -
removeByValueList
public static Operation removeByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create list remove operation. Server removes list items identified by values and returns removed data specified by returnType (SeeListReturnType). -
removeByValueRange
public static Operation removeByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create list remove operation. Server removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is null, the range is less than valueEnd. If valueEnd is null, the range is greater than equal to valueBegin.Server returns removed data specified by returnType (See
ListReturnType). -
removeByValueRelativeRankRange
public static Operation removeByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create list remove by value relative to rank range operation. Server removes list items nearest to value and greater by relative rank. Server returns removed data specified by returnType (SeeListReturnType).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank) = [removed items]
- (5,0) = [5,9,11,15]
- (5,1) = [9,11,15]
- (5,-1) = [4,5,9,11,15]
- (3,0) = [4,5,9,11,15]
- (3,3) = [11,15]
- (3,-3) = [0,4,5,9,11,15]
-
removeByValueRelativeRankRange
public static Operation removeByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create list remove by value relative to rank range operation. Server removes list items nearest to value and greater by relative rank with a count limit. Server returns removed data specified by returnType (SeeListReturnType).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank,count) = [removed items]
- (5,0,2) = [5,9]
- (5,1,1) = [9]
- (5,-1,2) = [4,5]
- (3,0,1) = [4]
- (3,3,7) = [11,15]
- (3,-3,2) = []
-
removeByIndex
Create list remove operation. Server removes list item identified by index and returns removed data specified by returnType (SeeListReturnType). -
removeByIndexRange
Create list remove operation. Server removes list items starting at specified index to the end of list and returns removed data specified by returnType (SeeListReturnType). -
removeByIndexRange
public static Operation removeByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create list remove operation. Server removes "count" list items starting at specified index and returns removed data specified by returnType (SeeListReturnType). -
removeByRank
Create list remove operation. Server removes list item identified by rank and returns removed data specified by returnType (SeeListReturnType). -
removeByRankRange
Create list remove operation. Server removes list items starting at specified rank to the last ranked item and returns removed data specified by returnType (SeeListReturnType). -
removeByRankRange
public static Operation removeByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create list remove operation. Server removes "count" list items starting at specified rank and returns removed data specified by returnType (SeeListReturnType). -
size
Create list size operation. Server returns size of list. -
get
Create list get operation. Server returns item at specified index in list bin. -
getRange
Create list get range operation. Server returns "count" items starting at specified index in list bin. -
getRange
Create list get range operation. Server returns items starting at index to the end of list. -
getByValue
Create list get by value operation. Server selects list items identified by value and returns selected data specified by returnType (SeeListReturnType). -
getByValueRange
public static Operation getByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create list get by value range operation. Server selects list items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is null, the range is less than valueEnd. If valueEnd is null, the range is greater than equal to valueBegin.Server returns selected data specified by returnType (See
ListReturnType). -
getByValueList
public static Operation getByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create list get by value list operation. Server selects list items identified by values and returns selected data specified by returnType (SeeListReturnType). -
getByValueRelativeRankRange
public static Operation getByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create list get by value relative to rank range operation. Server selects list items nearest to value and greater by relative rank. Server returns selected data specified by returnType (SeeListReturnType).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank) = [selected items]
- (5,0) = [5,9,11,15]
- (5,1) = [9,11,15]
- (5,-1) = [4,5,9,11,15]
- (3,0) = [4,5,9,11,15]
- (3,3) = [11,15]
- (3,-3) = [0,4,5,9,11,15]
-
getByValueRelativeRankRange
public static Operation getByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create list get by value relative to rank range operation. Server selects list items nearest to value and greater by relative rank with a count limit. Server returns selected data specified by returnType (SeeListReturnType).Examples for ordered list [0,4,5,9,11,15]:
- (value,rank,count) = [selected items]
- (5,0,2) = [5,9]
- (5,1,1) = [9]
- (5,-1,2) = [4,5]
- (3,0,1) = [4]
- (3,3,7) = [11,15]
- (3,-3,2) = []
-
getByIndex
Create list get by index operation. Server selects list item identified by index and returns selected data specified by returnType (SeeListReturnType). -
getByIndexRange
Create list get by index range operation. Server selects list items starting at specified index to the end of list and returns selected data specified by returnType (SeeListReturnType). -
getByIndexRange
public static Operation getByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create list get by index range operation. Server selects "count" list items starting at specified index and returns selected data specified by returnType (SeeListReturnType). -
getByRank
Create list get by rank operation. Server selects list item identified by rank and returns selected data specified by returnType (SeeListReturnType). -
getByRankRange
Create list get by rank range operation. Server selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType (SeeListReturnType). -
getByRankRange
public static Operation getByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create list get by rank range operation. Server selects "count" list items starting at specified rank and returns selected data specified by returnType (SeeListReturnType).
-