|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.aerospike.client.AerospikeClient com.aerospike.client.async.AsyncClient
public class AsyncClient
Asynchronous Aerospike client.
Your application uses this class to perform asynchronous database operations such as writing and reading records, and selecting sets of records. Write operations include specialized functionality such as append/prepend and arithmetic addition.
This client is thread-safe. One client instance should be used per cluster. Multiple threads should share this cluster instance.
Each record may have multiple bins, unless the Aerospike server nodes are configured as "single-bin". In "multi-bin" mode, partial records may be written or read by specifying the relevant subset of bins.
Constructor Summary | |
---|---|
AsyncClient(AsyncClientPolicy policy,
Host... hosts)
Initialize asynchronous client with suitable hosts to seed the cluster map. |
|
AsyncClient(AsyncClientPolicy policy,
String hostname,
int port)
Initialize asynchronous client. |
|
AsyncClient(String hostname,
int port)
Initialize asynchronous client. |
Method Summary | |
---|---|
void |
add(WritePolicy policy,
WriteListener listener,
Key key,
Bin... bins)
Asynchronously add integer bin values to existing record bin values. |
void |
append(WritePolicy policy,
WriteListener listener,
Key key,
Bin... bins)
Asynchronously append bin string values to existing record bin values. |
void |
delete(WritePolicy policy,
DeleteListener listener,
Key key)
Asynchronously delete record for specified key. |
void |
exists(Policy policy,
ExistsArrayListener listener,
Key[] keys)
Asynchronously check if multiple record keys exist in one batch call. |
void |
exists(Policy policy,
ExistsListener listener,
Key key)
Asynchronously determine if a record key exists. |
void |
exists(Policy policy,
ExistsSequenceListener listener,
Key[] keys)
Asynchronously check if multiple record keys exist in one batch call. |
void |
get(Policy policy,
RecordArrayListener listener,
Key[] keys)
Asynchronously read multiple records for specified keys in one batch call. |
void |
get(Policy policy,
RecordArrayListener listener,
Key[] keys,
String... binNames)
Asynchronously read multiple record headers and bins for specified keys in one batch call. |
void |
get(Policy policy,
RecordListener listener,
Key key)
Asynchronously read entire record for specified key. |
void |
get(Policy policy,
RecordListener listener,
Key key,
String... binNames)
Asynchronously read record header and bins for specified key. |
void |
get(Policy policy,
RecordSequenceListener listener,
Key[] keys)
Asynchronously read multiple records for specified keys in one batch call. |
void |
get(Policy policy,
RecordSequenceListener listener,
Key[] keys,
String... binNames)
Asynchronously read multiple record headers and bins for specified keys in one batch call. |
void |
getHeader(Policy policy,
RecordArrayListener listener,
Key[] keys)
Asynchronously read multiple record header data for specified keys in one batch call. |
void |
getHeader(Policy policy,
RecordListener listener,
Key key)
Asynchronously read record generation and expiration only for specified key. |
void |
getHeader(Policy policy,
RecordSequenceListener listener,
Key[] keys)
Asynchronously read multiple record header data for specified keys in one batch call. |
void |
operate(WritePolicy policy,
RecordListener listener,
Key key,
Operation... operations)
Asynchronously perform multiple read/write operations on a single key in one batch call. |
void |
prepend(WritePolicy policy,
WriteListener listener,
Key key,
Bin... bins)
Asynchronously prepend bin string values to existing record bin values. |
void |
put(WritePolicy policy,
WriteListener listener,
Key key,
Bin... bins)
Asynchronously write record bin(s). |
void |
scanAll(ScanPolicy policy,
RecordSequenceListener listener,
String namespace,
String setName,
String... binNames)
Asynchronously read all records in specified namespace and set. |
void |
touch(WritePolicy policy,
WriteListener listener,
Key key)
Asynchronously create record if it does not already exist. |
Methods inherited from class com.aerospike.client.AerospikeClient |
---|
add, append, close, createIndex, delete, dropIndex, execute, execute, exists, exists, get, get, get, get, getHeader, getHeader, getLargeList, getLargeMap, getLargeSet, getLargeStack, getNodeNames, getNodes, isConnected, operate, prepend, put, query, queryAggregate, register, scanAll, scanNode, scanNode, touch |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsyncClient(String hostname, int port) throws AerospikeException
- Add host to the cluster map
- Request host's list of other nodes in cluster
- Add these nodes to cluster map
If the connection succeeds, the client is ready to process database requests. If the connection fails, the cluster will remain in a disconnected state until the server is activated.
hostname
- host nameport
- host port
AerospikeException
- if host connection failspublic AsyncClient(AsyncClientPolicy policy, String hostname, int port) throws AerospikeException
- Add host to the cluster map
- Request host's list of other nodes in cluster
- Add these nodes to cluster map
If the connection succeeds, the client is ready to process database requests. If the connection fails and the policy's failOnInvalidHosts is true, a connection exception will be thrown. Otherwise, the cluster will remain in a disconnected state until the server is activated.
policy
- client configuration parameters, pass in null for defaultshostname
- host nameport
- host port
AerospikeException
- if host connection failspublic AsyncClient(AsyncClientPolicy policy, Host... hosts) throws AerospikeException
- Add host to the cluster map
- Request host's list of other nodes in cluster
- Add these nodes to cluster map
In most cases, only one host is necessary to seed the cluster. The remaining hosts are added as future seeds in case of a complete network failure.
If one connection succeeds, the client is ready to process database requests. If all connections fail and the policy's failIfNotConnected is true, a connection exception will be thrown. Otherwise, the cluster will remain in a disconnected state until the server is activated.
policy
- client configuration parameters, pass in null for defaultshosts
- array of potential hosts to seed the cluster
AerospikeException
- if all host connections failMethod Detail |
---|
public final void put(WritePolicy policy, WriteListener listener, Key key, Bin... bins) throws AerospikeException
The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifierbins
- array of bin name/value pairs
AerospikeException
- if queue is fullpublic final void append(WritePolicy policy, WriteListener listener, Key key, Bin... bins) throws AerospikeException
The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for string values.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifierbins
- array of bin name/value pairs
AerospikeException
- if queue is fullpublic final void prepend(WritePolicy policy, WriteListener listener, Key key, Bin... bins) throws AerospikeException
The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call works only for string values.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifierbins
- array of bin name/value pairs
AerospikeException
- if queue is fullpublic final void add(WritePolicy policy, WriteListener listener, Key key, Bin... bins) throws AerospikeException
The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for integer values.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifierbins
- array of bin name/value pairs
AerospikeException
- if queue is fullpublic final void delete(WritePolicy policy, DeleteListener listener, Key key) throws AerospikeException
The policy specifies the transaction timeout.
policy
- delete configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifier
AerospikeException
- if queue is fullpublic final void touch(WritePolicy policy, WriteListener listener, Key key) throws AerospikeException
This method schedules the touch command with a channel selector and returns. Another thread will process the command and send the results to the listener.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifier
AerospikeException
- if queue is fullpublic final void exists(Policy policy, ExistsListener listener, Key key) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskey
- unique record identifier
AerospikeException
- if queue is fullpublic final void exists(Policy policy, ExistsArrayListener listener, Key[] keys) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void exists(Policy policy, ExistsSequenceListener listener, Key[] keys) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordListener listener, Key key) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskey
- unique record identifier
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordListener listener, Key key, String... binNames) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskey
- unique record identifierbinNames
- bins to retrieve
AerospikeException
- if queue is fullpublic final void getHeader(Policy policy, RecordListener listener, Key key) throws AerospikeException
The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskey
- unique record identifier
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordArrayListener listener, Key[] keys) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordSequenceListener listener, Key[] keys) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordArrayListener listener, Key[] keys, String... binNames) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiersbinNames
- array of bins to retrieve
AerospikeException
- if queue is fullpublic final void get(Policy policy, RecordSequenceListener listener, Key[] keys, String... binNames) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiersbinNames
- array of bins to retrieve
AerospikeException
- if queue is fullpublic final void getHeader(Policy policy, RecordArrayListener listener, Key[] keys) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void getHeader(Policy policy, RecordSequenceListener listener, Key[] keys) throws AerospikeException
If a key is not found, the record will be null. The policy can be used to specify timeouts.
policy
- generic configuration parameters, pass in null for defaultslistener
- where to send resultskeys
- array of unique record identifiers
AerospikeException
- if queue is fullpublic final void operate(WritePolicy policy, RecordListener listener, Key key, Operation... operations) throws AerospikeException
This method schedules the operate command with a channel selector and returns. Another thread will process the command and send the results to the listener.
policy
- write configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetkey
- unique record identifieroperations
- database operations to perform
AerospikeException
- if queue is fullpublic final void scanAll(ScanPolicy policy, RecordSequenceListener listener, String namespace, String setName, String... binNames) throws AerospikeException
concurrentNodes
is specified, each server node will be read in
parallel. Otherwise, server nodes are read in series.
This method schedules the scan command with a channel selector and returns. Another thread will process the command and send the results to the listener.
policy
- scan configuration parameters, pass in null for defaultslistener
- where to send results, pass in null for fire and forgetnamespace
- namespace - equivalent to database namesetName
- optional set name - equivalent to database tablebinNames
- optional bin to retrieve. All bins will be returned if not specified.
Aerospike 2 servers ignore this parameter.
AerospikeException
- if queue is full
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |