public static byte[] Pack(IList val) { Packer packer = new Packer(); packer.PackList(val); return(packer.ToByteArray()); }
public override void Pack(Packer packer) { // List values need an extra array and QUOTED in order to distinguish // between a multiple argument array call and a local list. packer.PackArrayBegin(2); packer.PackNumber(QUOTED); packer.PackList(list); }
/// <summary> /// Create HLL getIntersectCount operation. /// Server returns estimated number of elements that would be contained by the intersection of /// these HLL objects. /// </summary> /// <param name="binName">name of bin</param> /// <param name="list">list of HLL objects</param> public static Operation GetIntersectCount(string binName, IList <Value.HLLValue> list) { Packer packer = new Packer(); Init(packer, INTERSECT_COUNT, 1); packer.PackList((IList)list); return(new Operation(Operation.Type.HLL_READ, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create HLL getSimilarity operation. /// Server returns estimated similarity of these HLL objects. Return type is a double. /// </summary> /// <param name="binName">name of bin</param> /// <param name="list">list of HLL objects</param> public static Operation GetSimilarity(string binName, IList <Value.HLLValue> list) { Packer packer = new Packer(); Init(packer, SIMILARITY, 1); packer.PackList((IList)list); return(new Operation(Operation.Type.HLL_READ, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create default list append items operation. /// Server appends each input list item to end of list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(string binName, IList list, params CTX[] ctx) { Packer packer = new Packer(); CDT.Init(packer, ctx, APPEND_ITEMS, 1); packer.PackList(list); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create default list insert items operation. /// Server inserts each input list item starting at specified index of list bin. /// Server returns list size. /// </summary> public static Operation InsertItems(string binName, int index, IList list, params CTX[] ctx) { Packer packer = new Packer(); CDT.Init(packer, ctx, INSERT_ITEMS, 2); packer.PackNumber(index); packer.PackList(list); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create HLL set union operation. /// Server sets union of specified HLL objects with HLL bin. /// Server does not return a value. /// </summary> /// <param name="policy">write policy, use <seealso cref="HLLPolicy.Default"/> for default</param> /// <param name="binName">name of bin</param> /// <param name="list">list of HLL objects</param> public static Operation SetUnion(HLLPolicy policy, string binName, IList <Value.HLLValue> list) { Packer packer = new Packer(); Init(packer, SET_UNION, 2); packer.PackList((IList)list); packer.PackNumber(policy.flags); return(new Operation(Operation.Type.HLL_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create default list append items operation. /// Server appends each input list item to end of list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(string binName, IList list) { Packer packer = new Packer(); packer.PackRawShort(APPEND_ITEMS); packer.PackArrayBegin(1); packer.PackList(list); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
protected internal static Operation CreateOperation(int command, Operation.Type type, string binName, CTX[] ctx, int v1, IList v2) { Packer packer = new Packer(); CDT.Init(packer, ctx, command, 2); packer.PackNumber(v1); packer.PackList(v2); return(new Operation(type, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create default list insert items operation. /// Server inserts each input list item starting at specified index of list bin. /// Server returns list size. /// </summary> public static Operation InsertItems(string binName, int index, IList list) { Packer packer = new Packer(); packer.PackRawShort(INSERT_ITEMS); packer.PackArrayBegin(2); packer.PackNumber(index); packer.PackList(list); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create list append items operation with policy. /// Server appends each input list item to list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(ListPolicy policy, string binName, IList list, params CTX[] ctx) { Packer packer = new Packer(); CDT.Init(packer, ctx, APPEND_ITEMS, 3); packer.PackList(list); packer.PackNumber(policy.attributes); packer.PackNumber(policy.flags); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
protected internal static Operation CreateOperation(int command, Operation.Type type, string binName, int v1, IList v2) { Packer packer = new Packer(); packer.PackRawShort(command); packer.PackArrayBegin(2); packer.PackNumber(v1); packer.PackList(v2); return(new Operation(type, binName, Value.Get(packer.ToByteArray()))); }
private static byte[] PackList(int command, IList <Value.HLLValue> list) { Packer packer = new Packer(); // Pack.Init() only required when CTX is used and server does not support CTX for bit operations. // Pack.Init(packer, ctx); packer.PackArrayBegin(2); packer.PackNumber(command); packer.PackList((IList)list); return(packer.ToByteArray()); }
/// <summary> /// Create list append items operation with policy. /// Server appends each input list item to list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(ListPolicy policy, string binName, IList list) { Packer packer = new Packer(); packer.PackRawShort(APPEND_ITEMS); packer.PackArrayBegin(3); packer.PackList(list); packer.PackNumber(policy.attributes); packer.PackNumber(policy.flags); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
/// <summary> /// Create HLL add operation with minhash bits. /// Server adds values to HLL set. If HLL bin does not exist, use indexBitCount and minHashBitCount /// to create HLL bin. Server returns number of entries that caused HLL to update a register. /// </summary> /// <param name="policy">write policy, use <seealso cref="HLLPolicy.Default"/> for default</param> /// <param name="binName">name of bin</param> /// <param name="list">list of values to be added</param> /// <param name="indexBitCount">number of index bits. Must be between 4 and 16 inclusive.</param> /// <param name="minHashBitCount">number of min hash bits. Must be between 4 and 58 inclusive.</param> public static Operation Add(HLLPolicy policy, string binName, IList list, int indexBitCount, int minHashBitCount) { Packer packer = new Packer(); Init(packer, ADD, 4); packer.PackList(list); packer.PackNumber(indexBitCount); packer.PackNumber(minHashBitCount); packer.PackNumber(policy.flags); return(new Operation(Operation.Type.HLL_MODIFY, binName, Value.Get(packer.ToByteArray()))); }
public static byte[] Pack(int command, int v1, IList list, params CTX[] ctx) { Packer packer = new Packer(); Init(packer, ctx); packer.PackArrayBegin(3); packer.PackNumber(command); packer.PackNumber(v1); packer.PackList(list); return(packer.ToByteArray()); }
/// <summary> /// Create default list append items operation. /// Server appends each input list item to end of list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(string binName, IList list, params CTX[] ctx) { // Compiler bug prevents calling of this method. // byte[] bytes = PackUtil.Pack(ListOperation.APPEND_ITEMS, list, ctx); // Duplicate method instead. Packer packer = new Packer(); PackUtil.Init(packer, ctx); packer.PackArrayBegin(2); packer.PackNumber(ListOperation.APPEND_ITEMS); packer.PackList(list); byte[] bytes = packer.ToByteArray(); return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes))); }
public static byte[] Pack(IList val) { Packer packer = new Packer(); packer.PackList(val); return packer.ToByteArray(); }
/// <summary> /// Create list append items operation. /// Server appends each input list item to end of list bin. /// Server returns list size. /// </summary> public static Operation AppendItems(string binName, IList list) { Packer packer = new Packer(); packer.PackRawShort(APPEND_ITEMS); packer.PackArrayBegin(1); packer.PackList(list); byte[] bytes = packer.ToByteArray(); return new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes)); }
protected internal static Operation CreateOperation(int command, Operation.Type type, string binName, IList list, MapReturnType returnType) { Packer packer = new Packer(); packer.PackRawShort(command); packer.PackArrayBegin(2); packer.PackNumber((int)returnType); packer.PackList(list); return new Operation(type, binName, Value.Get(packer.ToByteArray())); }
public override void Pack(Packer packer) { packer.PackList(list); }
public override void Pack(Packer packer) { packer.PackList(list); }
/// <summary> /// Create list insert items operation. /// Server inserts each input list item starting at specified index of list bin. /// Server returns list size. /// </summary> public static Operation InsertItems(string binName, int index, IList list) { Packer packer = new Packer(); packer.PackRawShort(INSERT_ITEMS); packer.PackArrayBegin(2); packer.PackNumber(index); packer.PackList(list); byte[] bytes = packer.ToByteArray(); return new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes)); }