Пример #1
0
        public AsyncBatchExistsSequenceExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            Key[] keys,
            ExistsSequenceListener listener
        ) : base(cluster, policy, keys)
        {
            this.listener = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (batchNode.node.UseNewBatch(policy))
                {
                    // New batch
                    tasks[count++] = new AsyncBatchExistsSequenceCommand(this, cluster, batchNode, policy, keys, listener);
                }
                else
                {
                    // Old batch only allows one namespace per call.
                    foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                    {
                        tasks[count++] = new AsyncBatchExistsSequenceDirect(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, listener);
                    }
                }
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
Пример #2
0
 public AsyncBatchExistsSequenceCommand(AsyncBatchExistsSequenceCommand other) : base(other)
 {
     this.batch       = other.batch;
     this.batchPolicy = other.batchPolicy;
     this.keys        = other.keys;
     this.listener    = other.listener;
 }
 public AsyncBatchExistsSequenceCommand
 (
     AsyncMultiExecutor parent,
     AsyncCluster cluster,
     BatchNode batch,
     BatchPolicy batchPolicy,
     Key[] keys,
     ExistsSequenceListener listener
 ) : base(parent, cluster, batch, batchPolicy)
 {
     this.keys     = keys;
     this.listener = listener;
 }
Пример #4
0
 public AsyncBatchExistsSequenceCommand
 (
     AsyncMultiExecutor parent,
     AsyncCluster cluster,
     BatchNode batch,
     BatchPolicy policy,
     Key[] keys,
     ExistsSequenceListener listener
 ) : base(parent, cluster, (AsyncNode)batch.node, false)
 {
     this.batch    = batch;
     this.policy   = policy;
     this.keys     = keys;
     this.listener = listener;
 }
Пример #5
0
 public AsyncBatchExistsSequenceDirect
 (
     AsyncMultiExecutor parent,
     AsyncCluster cluster,
     AsyncNode node,
     BatchNode.BatchNamespace batch,
     Policy policy,
     Key[] keys,
     ExistsSequenceListener listener
 ) : base(parent, cluster, policy, node, false)
 {
     this.batch    = batch;
     this.keys     = keys;
     this.listener = listener;
 }
        public AsyncBatchExistsSequenceExecutor(AsyncCluster cluster, BatchPolicy policy, Key[] keys, ExistsSequenceListener listener)
            : base(cluster, policy, keys)
        {
            this.listener = listener;

            // Dispatch asynchronous commands to nodes.
            foreach (BatchNode batchNode in batchNodes)
            {
                foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                {
                    AsyncBatchExistsSequence async = new AsyncBatchExistsSequence(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, listener);
                    async.Execute();
                }
            }
        }
        public AsyncBatchExistsSequenceExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            Key[] keys,
            ExistsSequenceListener listener
        ) : base(cluster, policy, keys, false)
        {
            this.listener = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                tasks[count++] = new AsyncBatchExistsSequenceCommand(this, cluster, batchNode, policy, keys, listener);
            }
            // Dispatch commands to nodes.
            Execute(tasks, 0);
        }
Пример #8
0
        public AsyncBatchExistsSequenceExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            Key[] keys,
            ExistsSequenceListener listener
        )
        {
            this.listener = listener;

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

            AsyncBatchCommand[] commands = new AsyncBatchCommand[batchNodes.Count];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                commands[count++] = new AsyncBatchExistsSequenceCommand(this, cluster, batchNode, policy, keys, listener);
            }
            // Dispatch commands to nodes.
            Execute(commands);
        }
Пример #9
0
        public AsyncBatchExistsSequenceDirect(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			AsyncNode node,
			BatchNode.BatchNamespace batch,
			Policy policy,
			Key[] keys,
			ExistsSequenceListener listener
		)
            : base(parent, cluster, node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.keys = keys;
            this.listener = listener;
        }
Пример #10
0
        public AsyncBatchExistsSequenceCommand(
			AsyncMultiExecutor parent,
			AsyncCluster cluster,
			BatchNode batch,
			BatchPolicy policy,
			Key[] keys,
			ExistsSequenceListener listener
		)
            : base(parent, cluster, (AsyncNode)batch.node, false)
        {
            this.batch = batch;
            this.policy = policy;
            this.keys = keys;
            this.listener = listener;
        }
Пример #11
0
        public AsyncBatchExistsSequenceExecutor(
			AsyncCluster cluster,
			BatchPolicy policy,
			Key[] keys,
			ExistsSequenceListener listener
		)
            : base(cluster, policy, keys)
        {
            this.listener = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (batchNode.node.UseNewBatch(policy))
                {
                    // New batch
                    tasks[count++] = new AsyncBatchExistsSequenceCommand(this, cluster, batchNode, policy, keys, listener);
                }
                else
                {
                    // Old batch only allows one namespace per call.
                    foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                    {
                        tasks[count++] = new AsyncBatchExistsSequenceDirect(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, listener);
                    }
                }
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
Пример #12
0
 public AsyncBatchExistsSequenceDirect(AsyncBatchExistsSequenceDirect other) : base(other)
 {
     this.batch    = other.batch;
     this.keys     = other.keys;
     this.listener = other.listener;
 }
 /// <summary>
 /// Asynchronously check if multiple record keys exist in one batch call.
 /// Schedule the exists command with a channel selector and return.
 /// Another thread will process the command and send the results to the listener in multiple unordered calls.
 /// <para>
 /// The policy can be used to specify timeouts.
 /// </para>
 /// </summary>
 /// <param name="policy">generic configuration parameters, pass in null for defaults</param>
 /// <param name="listener">where to send results</param>
 /// <param name="keys">array of unique record identifiers</param>
 /// <exception cref="AerospikeException">if queue is full</exception>
 public void Exists(BatchPolicy policy, ExistsSequenceListener listener, Key[] keys)
 {
     if (keys.Length == 0)
     {
         listener.OnSuccess();
         return;
     }
     if (policy == null)
     {
         policy = batchPolicyDefault;
     }
     new AsyncBatchExistsSequenceExecutor(cluster, policy, keys, listener);
 }
 public void Exists(Policy policy, ExistsSequenceListener listener, Key[] keys)
 {
     BatchPolicy batchPolicy = GetAsyncBatchPolicy(policy);
     Exists(batchPolicy, listener, keys);
 }