MapOperation Class

Map bin operations. Create map operations used by the client operate command. The default unique key map is unordered. Valid map key types are:
  • 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}}}

Definition

Namespace: Aerospike.Client
Assembly: AerospikeClient (in AerospikeClient.dll) Version: 7.2.0+3ff890475e5241c4ec994b6f9316c3e202db5797
C#
public class MapOperation
Inheritance
Object    MapOperation

Constructors

MapOperationInitializes a new instance of the MapOperation class

Methods

Clear Create map clear operation. Server removes all items in map. Server returns null.
Create(String, MapOrder, CTX) Create map create operation. Server creates map at given context level.
Create(String, MapOrder, Boolean, CTX) Create map create operation. Server creates map at given context level.
Decrement 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 MapPolicy and write mode MapWriteMode.


Obsolete.
GetByIndex Create map get by index operation. Server selects map item identified by index and returns selected data specified by returnType.
GetByIndexRange(String, Int32, MapReturnType, CTX) 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.
GetByIndexRange(String, Int32, Int32, MapReturnType, CTX) Create map get by index range operation. Server selects "count" map items starting at specified index and returns selected data specified by returnType.
GetByKey Create map get by key operation. Server selects map item identified by key and returns selected data specified by returnType.
GetByKeyList Create map get by key list operation. Server selects map items identified by keys and returns selected data specified by returnType.
GetByKeyRange 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.

GetByKeyRelativeIndexRange(String, Value, Int32, MapReturnType, 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.

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(String, Value, Int32, Int32, MapReturnType, 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.

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}]

GetByRank Create map get by rank operation. Server selects map item identified by rank and returns selected data specified by returnType.
GetByRankRange(String, Int32, MapReturnType, CTX) 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.
GetByRankRange(String, Int32, Int32, MapReturnType, CTX) Create map get by rank range operation. Server selects "count" map items starting at specified rank and returns selected data specified by returnType.
GetByValue Create map get by value operation. Server selects map items identified by value and returns selected data specified by returnType.
GetByValueList Create map get by value list operation. Server selects map items identified by values and returns selected data specified by returnType.
GetByValueRange 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.

GetByValueRelativeRankRange(String, Value, Int32, MapReturnType, 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.

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(String, Value, Int32, Int32, MapReturnType, 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.

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}]

Increment 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 MapPolicy and write mode MapWriteMode.

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 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.

RemoveByIndex Create map remove operation. Server removes map item identified by index and returns removed data specified by returnType.
RemoveByIndexRange(String, Int32, MapReturnType, CTX) Create map remove operation. Server removes map items starting at specified index to the end of map and returns removed data specified by returnType.
RemoveByIndexRange(String, Int32, Int32, MapReturnType, CTX) Create map remove operation. Server removes "count" map items starting at specified index and returns removed data specified by returnType.
RemoveByKey Create map remove operation. Server removes map item identified by key and returns removed data specified by returnType.
RemoveByKeyList Create map remove operation. Server removes map items identified by keys and returns removed data specified by returnType.
RemoveByKeyRange 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.

RemoveByKeyRelativeIndexRange(String, Value, Int32, MapReturnType, 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.

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(String, Value, Int32, Int32, MapReturnType, 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.

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}]

RemoveByRank Create map remove operation. Server removes map item identified by rank and returns removed data specified by returnType.
RemoveByRankRange(String, Int32, MapReturnType, CTX) Create map remove operation. Server removes map items starting at specified rank to the last ranked item and returns removed data specified by returnType.
RemoveByRankRange(String, Int32, Int32, MapReturnType, CTX) Create map remove operation. Server removes "count" map items starting at specified rank and returns removed data specified by returnType.
RemoveByValue Create map remove operation. Server removes map items identified by value and returns removed data specified by returnType.
RemoveByValueList Create map remove operation. Server removes map items identified by values and returns removed data specified by returnType.
RemoveByValueRange 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.

RemoveByValueRelativeRankRange(String, Value, Int32, MapReturnType, 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.

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(String, Value, Int32, Int32, MapReturnType, 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.

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}]

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.

Size Create map size operation. Server returns size of map.

See Also