public AsyncBatchReadSequenceExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            BatchSequenceListener listener,
            List <BatchRead> records
        )
        {
            this.listener = listener;

            // Create commands.
            List <BatchNode> batchNodes = BatchNode.GenerateList(cluster, policy, records);

            AsyncMultiCommand[] tasks = new AsyncMultiCommand[batchNodes.Count];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (!batchNode.node.hasBatchIndex)
                {
                    throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Requested command requires a server that supports new batch index protocol.");
                }
                tasks[count++] = new AsyncBatchReadSequenceCommand(this, cluster, batchNode, policy, listener, records);
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
Example #2
0
 public AsyncBatchReadSequenceCommand(AsyncBatchReadSequenceCommand other) : base(other)
 {
     this.batch       = other.batch;
     this.batchPolicy = other.batchPolicy;
     this.listener    = other.listener;
     this.records     = other.records;
 }
 public AsyncBatchReadSequenceCommand
 (
     AsyncMultiExecutor parent,
     AsyncCluster cluster,
     BatchNode batch,
     BatchPolicy batchPolicy,
     BatchSequenceListener listener,
     List <BatchRead> records
 ) : base(parent, cluster, batch, batchPolicy)
 {
     this.listener = listener;
     this.records  = records;
 }
 public AsyncBatchReadSequenceCommand
 (
     AsyncMultiExecutor parent,
     AsyncCluster cluster,
     BatchNode batch,
     BatchPolicy policy,
     BatchSequenceListener listener,
     List <BatchRead> records
 ) : base(parent, cluster, (AsyncNode)batch.node, false)
 {
     this.batch    = batch;
     this.policy   = policy;
     this.listener = listener;
     this.records  = records;
 }
        public AsyncBatchReadSequenceExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            BatchSequenceListener listener,
            List <BatchRead> records
        ) : base(cluster, false)
        {
            this.listener = listener;

            // Create commands.
            List <BatchNode> batchNodes = BatchNode.GenerateList(cluster, policy, records);

            AsyncMultiCommand[] tasks = new AsyncMultiCommand[batchNodes.Count];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                tasks[count++] = new AsyncBatchReadSequenceCommand(this, cluster, batchNode, policy, listener, records);
            }
            // Dispatch commands to nodes.
            Execute(tasks, 0);
        }
        public AsyncBatchReadSequenceExecutor(
			AsyncCluster cluster,
			BatchPolicy policy,
			BatchSequenceListener listener,
			List<BatchRead> records
		)
        {
            this.listener = listener;

            // Create commands.
            List<BatchNode> batchNodes = BatchNode.GenerateList(cluster, policy, records);
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[batchNodes.Count];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (!batchNode.node.hasBatchIndex)
                {
                    throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Requested command requires a server that supports new batch index protocol.");
                }
                tasks[count++] = new AsyncBatchReadSequenceCommand(this, cluster, batchNode, policy, listener, records);
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
        public AsyncBatchReadSequenceCommand(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			BatchNode batch,
			BatchPolicy policy,
			BatchSequenceListener listener,
			List<BatchRead> records
		)
            : base(parent, cluster, (AsyncNode)batch.node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.listener = listener;
            this.records = records;
        }
 /// <summary>
 /// Asynchronously read multiple records for specified batch keys in one batch call.
 /// This method allows different namespaces/bins to be requested for each key in the batch.
 /// The returned records are located in the same list.
 /// If the BatchRecord key field is not found, the corresponding record field will be null.
 /// <para>
 /// This method schedules the get command with a channel selector and returns.
 /// Another thread will process the command and send the results to the listener in a single call.
 /// This method requires Aerospike Server version >= 3.6.0.
 /// </para>
 /// </summary>
 /// <param name="policy">batch configuration parameters, pass in null for defaults</param>
 /// <param name="listener">where to send results</param>
 /// <param name="records">list of unique record identifiers and the bins to retrieve.</param>
 /// <exception cref="AerospikeException">if read fails</exception>
 public void Get(BatchPolicy policy, BatchSequenceListener listener, List<BatchRead> records)
 {
     if (records.Count == 0)
     {
         listener.OnSuccess();
         return;
     }
     if (policy == null)
     {
         policy = batchPolicyDefault;
     }
     new AsyncBatchReadSequenceExecutor(cluster, policy, listener, records);
 }