Exemplo n.º 1
0
 /// <summary>
 /// Initialize result set with underlying producer/consumer queue.
 /// </summary>
 public ResultSet(QueryAggregateExecutor executor, int capacity, CancellationToken cancelToken)
 {
     this.executor = executor;
     this.queue = new BlockingCollection<object>(capacity);
     this.cancelToken = cancelToken;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initialize result set with underlying producer/consumer queue.
 /// </summary>
 public ResultSet(QueryAggregateExecutor executor, int capacity, CancellationToken cancelToken)
 {
     this.executor    = executor;
     this.queue       = new BlockingCollection <object>(capacity);
     this.cancelToken = cancelToken;
 }
        /// <summary>
        /// Execute query, apply statement's aggregation function, and return result iterator. 
        /// The aggregation function should be initialized via the statement's SetAggregateFunction()
        /// and should be located in a Lua resource file located in an assembly.
        /// <para>
        /// The query executor puts results on a queue in separate threads.  The calling thread 
        /// concurrently pops results off the queue through the ResultSet iterator.
        /// The aggregation function is called on both server and client (final reduce).
        /// Therefore, the Lua script file must also reside on both server and client.
        /// </para>
        /// <para>
        /// This method is only supported by Aerospike 3 servers.
        /// </para>
        /// </summary>
        /// <param name="policy">generic configuration parameters, pass in null for defaults</param>
        /// <param name="statement">database query command with aggregate functions already initialized by SetAggregateFunction()</param>
        /// <exception cref="AerospikeException">if query fails</exception>
        public ResultSet QueryAggregate(QueryPolicy policy, Statement statement)
        {
            if (policy == null)
            {
                policy = queryPolicyDefault;
            }
            statement.Prepare(true);

            QueryAggregateExecutor executor = new QueryAggregateExecutor(cluster, policy, statement);
            executor.Execute();
            return executor.ResultSet;
        }