/// <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 HLL init operation with minhash bits.
        /// Server creates a new HLL or resets an existing HLL.
        /// 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="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 Init(HLLPolicy policy, string binName, int indexBitCount, int minHashBitCount)
        {
            Packer packer = new Packer();

            Init(packer, INIT, 3);
            packer.PackNumber(indexBitCount);
            packer.PackNumber(minHashBitCount);
            packer.PackNumber(policy.flags);
            return(new Operation(Operation.Type.HLL_MODIFY, binName, Value.Get(packer.ToByteArray())));
        }
 /// <summary>
 /// Create HLL add operation.
 /// Server adds values to HLL set. If HLL bin does not exist, use indexBitCount to create HLL bin.
 /// Server returns number of entries that caused HLL to update a register.
 /// </summary>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.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>
 public static Operation Add(HLLPolicy policy, string binName, IList list, int indexBitCount)
 {
     return(Add(policy, binName, list, indexBitCount, -1));
 }
 /// <summary>
 /// Create HLL add operation. This operation assumes HLL bin already exists.
 /// Server adds values to the HLL set.
 /// Server returns number of entries that caused HLL to update a register.
 /// </summary>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.HLLPolicy.Default"/> for default</param>
 /// <param name="binName">name of bin</param>
 /// <param name="list">list of values to be added</param>
 public static Operation Add(HLLPolicy policy, string binName, IList list)
 {
     return(Add(policy, binName, list, -1, -1));
 }
 /// <summary>
 /// Create HLL init operation with minhash bits.
 /// Server creates a new HLL or resets an existing HLL.
 /// Server does not return a value.
 /// </summary>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.HLLPolicy.Default"/> for default</param>
 /// <param name="binName">name of bin</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 51 inclusive.</param>
 public static Operation Init(HLLPolicy policy, string binName, int indexBitCount, int minHashBitCount)
 {
     byte[] bytes = PackUtil.Pack(HLLOperation.INIT, indexBitCount, minHashBitCount, policy.flags);
     return(new Operation(Operation.Type.HLL_MODIFY, binName, Value.Get(bytes)));
 }
 /// <summary>
 /// Create HLL init operation.
 /// Server creates a new HLL or resets an existing HLL.
 /// Server does not return a value.
 /// </summary>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.HLLPolicy.Default"/> for default</param>
 /// <param name="binName">name of bin</param>
 /// <param name="indexBitCount">number of index bits. Must be between 4 and 16 inclusive.</param>
 public static Operation Init(HLLPolicy policy, string binName, int indexBitCount)
 {
     return(Init(policy, binName, indexBitCount, -1));
 }
 /// <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 <see cref="Aerospike.Client.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)
 {
     byte[] bytes = PackListInt(HLLOperation.SET_UNION, list, policy.flags);
     return(new Operation(Operation.Type.HLL_MODIFY, binName, Value.Get(bytes)));
 }
Esempio n. 8
0
 /// <summary>
 /// Create expression that adds values to a HLL set and returns HLL set. If HLL bin does not
 /// exist, use indexBitCount and minHashBitCount to create HLL set.
 /// </summary>
 /// <example>
 /// <code>
 /// // Add values to HLL bin "a" and check count > 7
 /// Exp.GT(
 ///   HLLExp.GetCount(
 ///     HLLExp.Add(HLLPolicy.Default, Exp.Val(list), Exp.Val(10), Exp.Val(20), Exp.HLLBin("a"))),
 ///   Exp.Val(7))
 /// </code>
 /// </example>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.HLLPolicy.Default"/> for default</param>
 /// <param name="list">list bin or value expression of values to be added</param>
 /// <param name="indexBitCount">number of index bits expression. Must be between 4 and 16 inclusive.</param>
 /// <param name="minHashBitCount">number of min hash bits expression. Must be between 4 and 51 inclusive.</param>
 /// <param name="bin">HLL bin or value expression</param>
 public static Exp Add(HLLPolicy policy, Exp list, Exp indexBitCount, Exp minHashBitCount, Exp bin)
 {
     byte[] bytes = PackUtil.Pack(HLLOperation.ADD, list, indexBitCount, minHashBitCount, policy.flags);
     return(AddWrite(bin, bytes));
 }
Esempio n. 9
0
 /// <summary>
 /// Create expression that adds values to a HLL set and returns HLL set.
 /// If HLL bin does not exist, use indexBitCount to create HLL bin.
 /// </summary>
 /// <example>
 /// <code>
 /// // Add values to HLL bin "a" and check count > 7
 /// Exp.GT(
 ///   HLLExp.GetCount(
 ///     HLLExp.Add(HLLPolicy.Default, Exp.Val(list), Exp.Val(10), Exp.HLLBin("a"))),
 ///   Exp.Val(7))
 /// </code>
 /// </example>
 /// <param name="policy">write policy, use <see cref="Aerospike.Client.HLLPolicy.Default"/> for default</param>
 /// <param name="list">list bin or value expression of values to be added</param>
 /// <param name="indexBitCount">number of index bits expression. Must be between 4 and 16 inclusive.</param>
 /// <param name="bin">HLL bin or value expression</param>
 public static Exp Add(HLLPolicy policy, Exp list, Exp indexBitCount, Exp bin)
 {
     return(Add(policy, list, indexBitCount, Exp.Val(-1), bin));
 }