Search in sources :

Example 1 with AsyncScanPartitionExecutor

use of com.aerospike.client.async.AsyncScanPartitionExecutor in project aerospike-client-java by aerospike.

the class AerospikeClient method scanAll.

/**
 * Asynchronously read all records in specified namespace and set.  If the policy's
 * <code>concurrentNodes</code> is specified, each server node will be read in
 * parallel.  Otherwise, server nodes are read in series.
 * <p>
 * This method registers the command with an event loop and returns.
 * The event loop thread will process the command and send the results to the listener.
 *
 * @param eventLoop				event loop that will process the command. If NULL, the event
 * 								loop will be chosen by round-robin.
 * @param listener				where to send results
 * @param policy				scan configuration parameters, pass in null for defaults
 * @param namespace				namespace - equivalent to database name
 * @param setName				optional set name - equivalent to database table
 * @param binNames				optional bin to retrieve. All bins will be returned if not specified.
 * @throws AerospikeException	if event loop registration fails
 */
public final void scanAll(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, String namespace, String setName, String... binNames) throws AerospikeException {
    if (eventLoop == null) {
        eventLoop = cluster.eventLoops.next();
    }
    if (policy == null) {
        policy = scanPolicyDefault;
    }
    Node[] nodes = cluster.validateNodes();
    PartitionTracker tracker = new PartitionTracker(policy, nodes);
    new AsyncScanPartitionExecutor(eventLoop, cluster, policy, listener, namespace, setName, binNames, tracker);
}
Also used : PartitionTracker(com.aerospike.client.query.PartitionTracker) Node(com.aerospike.client.cluster.Node) BatchNode(com.aerospike.client.command.BatchNode) AsyncScanPartitionExecutor(com.aerospike.client.async.AsyncScanPartitionExecutor)

Example 2 with AsyncScanPartitionExecutor

use of com.aerospike.client.async.AsyncScanPartitionExecutor in project aerospike-client-java by aerospike.

the class AerospikeClient method scanPartitions.

/**
 * Asynchronously read records in specified namespace, set and partition filter.
 * <p>
 * This method registers the command with an event loop and returns.
 * The event loop thread will process the command and send the results to the listener.
 *
 * @param eventLoop				event loop that will process the command. If NULL, the event
 * 								loop will be chosen by round-robin.
 * @param listener				where to send results
 * @param policy				scan configuration parameters, pass in null for defaults
 * @param partitionFilter		filter on a subset of data partitions
 * @param namespace				namespace - equivalent to database name
 * @param setName				optional set name - equivalent to database table
 * @param binNames				optional bin to retrieve. All bins will be returned if not specified.
 * @throws AerospikeException	if event loop registration fails
 */
public final void scanPartitions(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, PartitionFilter partitionFilter, String namespace, String setName, String... binNames) throws AerospikeException {
    if (eventLoop == null) {
        eventLoop = cluster.eventLoops.next();
    }
    if (policy == null) {
        policy = scanPolicyDefault;
    }
    Node[] nodes = cluster.validateNodes();
    PartitionTracker tracker = new PartitionTracker(policy, nodes, partitionFilter);
    new AsyncScanPartitionExecutor(eventLoop, cluster, policy, listener, namespace, setName, binNames, tracker);
}
Also used : PartitionTracker(com.aerospike.client.query.PartitionTracker) Node(com.aerospike.client.cluster.Node) BatchNode(com.aerospike.client.command.BatchNode) AsyncScanPartitionExecutor(com.aerospike.client.async.AsyncScanPartitionExecutor)

Aggregations

AsyncScanPartitionExecutor (com.aerospike.client.async.AsyncScanPartitionExecutor)2 Node (com.aerospike.client.cluster.Node)2 BatchNode (com.aerospike.client.command.BatchNode)2 PartitionTracker (com.aerospike.client.query.PartitionTracker)2