Class MapOperation
- String
- Integer
- byte[]
The server will validate map key types in an upcoming release.
All maps maintain an index and a rank. The index is the item offset from the start of the map, for both unordered and ordered maps. The rank is the sorted index of the value component. Map supports negative indexing for index and rank.
Index examples:
- Index 0: First item in map.
- Index 4: Fifth item in map.
- Index -1: Last item in map.
- Index -3: Third to last item in map.
- Index 1 Count 2: Second and third items in map.
- Index -3 Count 3: Last three items in map.
- Index -5 Count 4: Range between fifth to last item to second to last item inclusive.
Rank examples:
- Rank 0: Item with lowest value rank in map.
- Rank 4: Fifth lowest ranked item in map.
- Rank -1: Item with highest ranked value in map.
- Rank -3: Item with third highest ranked value in map.
- Rank 1 Count 2: Second and third lowest ranked items in map.
- Rank -3 Count 3: Top three ranked items in map.
Nested CDT operations are supported by optional CTX context arguments. Examples:
- bin = {key1={key11=9,key12=4}, key2={key21=3,key22=5}}
- Set map value to 11 for map key "key21" inside of map key "key2".
- MapOperation.put(MapPolicy.Default, "bin", Value.get("key21"), Value.get(11), CTX.mapKey(Value.get("key2")))
- bin result = {key1={key11=9,key12=4},key2={key21=11,key22=5}}
- bin = {key1={key11={key111=1},key12={key121=5}}, key2={key21={"key211",7}}}
- Set map value to 11 in map key "key121" for highest ranked map ("key12") inside of map key "key1".
- MapOperation.put(MapPolicy.Default, "bin", Value.get("key121"), Value.get(11), CTX.mapKey(Value.get("key1")), CTX.mapRank(-1))
- bin result = {key1={key11={key111=1},key12={key121=11}}, key2={key21={"key211",7}}}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OperationCreate map clear operation.static OperationCreate map create operation.static OperationCreate map create operation.static OperationDeprecated.static OperationgetByIndex(String binName, int index, int returnType, CTX... ctx) Create map get by index operation.static OperationgetByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create map get by index range operation.static OperationgetByIndexRange(String binName, int index, int returnType, CTX... ctx) Create map get by index range operation.static OperationCreate map get by key operation.static OperationgetByKeyList(String binName, List<Value> keys, int returnType, CTX... ctx) Create map get by key list operation.static OperationgetByKeyRange(String binName, Value keyBegin, Value keyEnd, int returnType, CTX... ctx) Create map get by key range operation.static OperationgetByKeyRelativeIndexRange(String binName, Value key, int index, int count, int returnType, CTX... ctx) Create map get by key relative to index range operation.static OperationgetByKeyRelativeIndexRange(String binName, Value key, int index, int returnType, CTX... ctx) Create map get by key relative to index range operation.static OperationCreate map get by rank operation.static OperationgetByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create map get by rank range operation.static OperationgetByRankRange(String binName, int rank, int returnType, CTX... ctx) Create map get by rank range operation.static OperationgetByValue(String binName, Value value, int returnType, CTX... ctx) Create map get by value operation.static OperationgetByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create map get by value list operation.static OperationgetByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create map get by value range operation.static OperationgetByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create map get by value relative to rank range operation.static OperationgetByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create map get by value relative to rank range operation.static OperationCreate map increment operation.static OperationCreate map put operation.static OperationCreate map put items operation Server writes each map item to map bin and returns map size.static OperationremoveByIndex(String binName, int index, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByIndexRange(String binName, int index, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByKey(String binName, Value key, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByKeyList(String binName, List<Value> keys, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByKeyRange(String binName, Value keyBegin, Value keyEnd, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByKeyRelativeIndexRange(String binName, Value key, int index, int count, int returnType, CTX... ctx) Create map remove by key relative to index range operation.static OperationremoveByKeyRelativeIndexRange(String binName, Value key, int index, int returnType, CTX... ctx) Create map remove by key relative to index range operation.static OperationremoveByRank(String binName, int rank, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByRankRange(String binName, int rank, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByValue(String binName, Value value, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create map remove operation.static OperationremoveByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create map remove by value relative to rank range operation.static OperationremoveByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create map remove by value relative to rank range operation.static OperationsetMapPolicy(MapPolicy policy, String binName, CTX... ctx) Create set map policy operation.static OperationCreate map size operation.
-
Constructor Details
-
MapOperation
public MapOperation()
-
-
Method Details
-
create
Create map create operation. Server creates map at given context level. -
create
Create map create operation. Server creates map at given context level.- Parameters:
binName- bin nameorder- map orderpersistIndex- if true, persist map index. A map index improves lookup performance, but requires more storage. A map index can be created for a top-level ordered map only. Nested and unordered map indexes are not supported.ctx- optional path to nested map. If not defined, the top-level map is used.
-
setMapPolicy
Create set map policy operation. Server sets map policy attributes. Server returns null.The required map policy attributes can be changed after the map is created.
-
put
Create map put operation. Server writes key/value item to map bin and returns map size.The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the flags used when writing items to the map. See policy
MapPolicy. -
putItems
public static Operation putItems(MapPolicy policy, String binName, Map<Value, Value> map, CTX... ctx) Create map put items operation Server writes each map item to map bin and returns map size.The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the flags used when writing items to the map. See policy
MapPolicy. -
increment
public static Operation increment(MapPolicy policy, String binName, Value key, Value incr, CTX... ctx) Create map increment operation. Server increments values by incr for all items identified by key and returns final result. Valid only for numbers.The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See policy
MapPolicyand write flagsMapWriteFlags. -
decrement
@Deprecated public static Operation decrement(MapPolicy policy, String binName, Value key, Value decr, CTX... ctx) Deprecated.This method is deprecated. Useincrement(MapPolicy, String, Value, Value, CTX...)with a negative value instead.Create map decrement operation. Server decrements values by decr for all items identified by key and returns final result. Valid only for numbers.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See policy
MapPolicyand write flagsMapWriteFlags. -
clear
Create map clear operation. Server removes all items in map. Server returns null. -
removeByKey
Create map remove operation. Server removes map item identified by key and returns removed data specified by returnType (SeeMapReturnType). -
removeByKeyList
public static Operation removeByKeyList(String binName, List<Value> keys, int returnType, CTX... ctx) Create map remove operation. Server removes map items identified by keys and returns removed data specified by returnType (SeeMapReturnType). -
removeByKeyRange
public static Operation removeByKeyRange(String binName, Value keyBegin, Value keyEnd, int returnType, CTX... ctx) Create map remove operation. Server removes map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is null, the range is less than keyEnd. If keyEnd is null, the range is greater than equal to keyBegin.Server returns removed data specified by returnType (See
MapReturnType). -
removeByKeyRelativeIndexRange
public static Operation removeByKeyRelativeIndexRange(String binName, Value key, int index, int returnType, CTX... ctx) Create map remove by key relative to index range operation. Server removes map items nearest to key and greater by index. Server returns removed data specified by returnType (SeeMapReturnType).Examples for map [{0=17},{4=2},{5=15},{9=10}]:
- (value,index) = [removed items]
- (5,0) = [{5=15},{9=10}]
- (5,1) = [{9=10}]
- (5,-1) = [{4=2},{5=15},{9=10}]
- (3,2) = [{9=10}]
- (3,-2) = [{0=17},{4=2},{5=15},{9=10}]
-
removeByKeyRelativeIndexRange
public static Operation removeByKeyRelativeIndexRange(String binName, Value key, int index, int count, int returnType, CTX... ctx) Create map remove by key relative to index range operation. Server removes map items nearest to key and greater by index with a count limit. Server returns removed data specified by returnType (SeeMapReturnType).Examples for map [{0=17},{4=2},{5=15},{9=10}]:
- (value,index,count) = [removed items]
- (5,0,1) = [{5=15}]
- (5,1,2) = [{9=10}]
- (5,-1,1) = [{4=2}]
- (3,2,1) = [{9=10}]
- (3,-2,2) = [{0=17}]
-
removeByValue
Create map remove operation. Server removes map items identified by value and returns removed data specified by returnType (SeeMapReturnType). -
removeByValueList
public static Operation removeByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create map remove operation. Server removes map items identified by values and returns removed data specified by returnType (SeeMapReturnType). -
removeByValueRange
public static Operation removeByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create map remove operation. Server removes map 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
MapReturnType). -
removeByValueRelativeRankRange
public static Operation removeByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create map remove by value relative to rank range operation. Server removes map items nearest to value and greater by relative rank. Server returns removed data specified by returnType (SeeMapReturnType).Examples for map [{4=2},{9=10},{5=15},{0=17}]:
- (value,rank) = [removed items]
- (11,1) = [{0=17}]
- (11,-1) = [{9=10},{5=15},{0=17}]
-
removeByValueRelativeRankRange
public static Operation removeByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create map remove by value relative to rank range operation. Server removes map items nearest to value and greater by relative rank with a count limit. Server returns removed data specified by returnType (SeeMapReturnType).Examples for map [{4=2},{9=10},{5=15},{0=17}]:
- (value,rank,count) = [removed items]
- (11,1,1) = [{0=17}]
- (11,-1,1) = [{9=10}]
-
removeByIndex
Create map remove operation. Server removes map item identified by index and returns removed data specified by returnType (SeeMapReturnType). -
removeByIndexRange
Create map remove operation. Server removes map items starting at specified index to the end of map and returns removed data specified by returnType (SeeMapReturnType). -
removeByIndexRange
public static Operation removeByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create map remove operation. Server removes "count" map items starting at specified index and returns removed data specified by returnType (SeeMapReturnType). -
removeByRank
Create map remove operation. Server removes map item identified by rank and returns removed data specified by returnType (SeeMapReturnType). -
removeByRankRange
Create map remove operation. Server removes map items starting at specified rank to the last ranked item and returns removed data specified by returnType (SeeMapReturnType). -
removeByRankRange
public static Operation removeByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create map remove operation. Server removes "count" map items starting at specified rank and returns removed data specified by returnType (SeeMapReturnType). -
size
Create map size operation. Server returns size of map. -
getByKey
Create map get by key operation. Server selects map item identified by key and returns selected data specified by returnType (SeeMapReturnType). -
getByKeyRange
public static Operation getByKeyRange(String binName, Value keyBegin, Value keyEnd, int returnType, CTX... ctx) Create map get by key range operation. Server selects map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is null, the range is less than keyEnd. If keyEnd is null, the range is greater than equal to keyBegin.Server returns selected data specified by returnType (See
MapReturnType). -
getByKeyList
Create map get by key list operation. Server selects map items identified by keys and returns selected data specified by returnType (SeeMapReturnType). -
getByKeyRelativeIndexRange
public static Operation getByKeyRelativeIndexRange(String binName, Value key, int index, int returnType, CTX... ctx) Create map get by key relative to index range operation. Server selects map items nearest to key and greater by index. Server returns selected data specified by returnType (SeeMapReturnType).Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
- (value,index) = [selected items]
- (5,0) = [{5=15},{9=10}]
- (5,1) = [{9=10}]
- (5,-1) = [{4=2},{5=15},{9=10}]
- (3,2) = [{9=10}]
- (3,-2) = [{0=17},{4=2},{5=15},{9=10}]
-
getByKeyRelativeIndexRange
public static Operation getByKeyRelativeIndexRange(String binName, Value key, int index, int count, int returnType, CTX... ctx) Create map get by key relative to index range operation. Server selects map items nearest to key and greater by index with a count limit. Server returns selected data specified by returnType (SeeMapReturnType).Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]:
- (value,index,count) = [selected items]
- (5,0,1) = [{5=15}]
- (5,1,2) = [{9=10}]
- (5,-1,1) = [{4=2}]
- (3,2,1) = [{9=10}]
- (3,-2,2) = [{0=17}]
-
getByValue
Create map get by value operation. Server selects map items identified by value and returns selected data specified by returnType (SeeMapReturnType). -
getByValueRange
public static Operation getByValueRange(String binName, Value valueBegin, Value valueEnd, int returnType, CTX... ctx) Create map get by value range operation. Server selects map 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
MapReturnType). -
getByValueList
public static Operation getByValueList(String binName, List<Value> values, int returnType, CTX... ctx) Create map get by value list operation. Server selects map items identified by values and returns selected data specified by returnType (SeeMapReturnType). -
getByValueRelativeRankRange
public static Operation getByValueRelativeRankRange(String binName, Value value, int rank, int returnType, CTX... ctx) Create map get by value relative to rank range operation. Server selects map items nearest to value and greater by relative rank. Server returns selected data specified by returnType (SeeMapReturnType).Examples for map [{4=2},{9=10},{5=15},{0=17}]:
- (value,rank) = [selected items]
- (11,1) = [{0=17}]
- (11,-1) = [{9=10},{5=15},{0=17}]
-
getByValueRelativeRankRange
public static Operation getByValueRelativeRankRange(String binName, Value value, int rank, int count, int returnType, CTX... ctx) Create map get by value relative to rank range operation. Server selects map items nearest to value and greater by relative rank with a count limit. Server returns selected data specified by returnType (SeeMapReturnType).Examples for map [{4=2},{9=10},{5=15},{0=17}]:
- (value,rank,count) = [selected items]
- (11,1,1) = [{0=17}]
- (11,-1,1) = [{9=10}]
-
getByIndex
Create map get by index operation. Server selects map item identified by index and returns selected data specified by returnType (SeeMapReturnType). -
getByIndexRange
Create map get by index range operation. Server selects map items starting at specified index to the end of map and returns selected data specified by returnType (SeeMapReturnType). -
getByIndexRange
public static Operation getByIndexRange(String binName, int index, int count, int returnType, CTX... ctx) Create map get by index range operation. Server selects "count" map items starting at specified index and returns selected data specified by returnType (SeeMapReturnType). -
getByRank
Create map get by rank operation. Server selects map item identified by rank and returns selected data specified by returnType (SeeMapReturnType). -
getByRankRange
Create map get by rank range operation. Server selects map items starting at specified rank to the last ranked item and returns selected data specified by returnType (SeeMapReturnType). -
getByRankRange
public static Operation getByRankRange(String binName, int rank, int count, int returnType, CTX... ctx) Create map get by rank range operation. Server selects "count" map items starting at specified rank and returns selected data specified by returnType (SeeMapReturnType).
-