/// <summary> /// Create map put items operation /// Server writes each map item to map bin and returns map size. /// <para> /// 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 <seealso cref="Aerospike.Client.MapPolicy"/>. /// </para> /// </summary> public static Operation PutItems(MapPolicy policy, string binName, IDictionary map, params CTX[] ctx) { Packer packer = new Packer(); if (policy.flags != 0) { CDT.Init(packer, ctx, PUT_ITEMS, 3); packer.PackMap(map); packer.PackNumber(policy.attributes); packer.PackNumber(policy.flags); } else { if (policy.itemsCommand == REPLACE_ITEMS) { // Replace doesn't allow map attributes because it does not create on non-existing key. CDT.Init(packer, ctx, policy.itemsCommand, 1); packer.PackMap(map); } else { CDT.Init(packer, ctx, policy.itemsCommand, 2); packer.PackMap(map); packer.PackNumber(policy.attributes); } } return(new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create map put items operation /// Server writes each map item to map bin and returns map size. /// <para> /// 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 <seealso cref="Aerospike.Client.MapPolicy"/>. /// </para> /// </summary> public static Operation PutItems(MapPolicy policy, string binName, IDictionary map) { Packer packer = new Packer(); if (policy.flags != 0) { packer.PackRawShort(PUT_ITEMS); packer.PackArrayBegin(3); packer.PackMap(map); packer.PackNumber(policy.attributes); packer.PackNumber(policy.flags); } else { packer.PackRawShort(policy.itemsCommand); if (policy.itemsCommand == REPLACE_ITEMS) { // Replace doesn't allow map attributes because it does not create on non-existing key. packer.PackArrayBegin(1); packer.PackMap(map); } else { packer.PackArrayBegin(2); packer.PackMap(map); packer.PackNumber(policy.attributes); } } return(new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
public static byte[] Pack(IDictionary val) { Packer packer = new Packer(); packer.PackMap(val); return(packer.ToByteArray()); }
public static byte[] Pack(IDictionary val) { Packer packer = new Packer(); packer.PackMap(val); return packer.ToByteArray(); }
/// <summary> /// Create map put items operation /// Server writes each map item to map bin and returns map size. /// <para> /// 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 <seealso cref="Aerospike.Client.MapPolicy"/> and write mode /// <seealso cref="Aerospike.Client.MapWriteMode"/>. /// </para> /// </summary> public static Operation PutItems(MapPolicy policy, string binName, IDictionary map) { Packer packer = new Packer(); packer.PackRawShort(policy.itemsCommand); if (policy.itemsCommand == MapBase.REPLACE_ITEMS) { // Replace doesn't allow map attributes because it does not create on non-existing key. packer.PackArrayBegin(1); packer.PackMap(map); } else { packer.PackArrayBegin(2); packer.PackMap(map); packer.PackNumber(policy.attributes); } return new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray())); }
public override void Pack(Packer packer) { packer.PackMap(map); }