Class AerospikeClient
- All Implemented Interfaces:
IAerospikeClient,Closeable,AutoCloseable
AerospikeClient object to access an Aerospike
database cluster and perform database operations.
This client is thread-safe. One client instance should be used per cluster. Multiple threads should share this cluster instance.
Your application uses this class API to perform 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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BatchDeletePolicyDefault delete policy used in batch delete commands.final BatchPolicyDefault parent policy used in batch write commands.final BatchPolicyDefault parent policy used in batch read commands.final BatchUDFPolicyDefault user defined function policy used in batch UDF execute commands.final BatchWritePolicyDefault write policy used in batch operate commands.final InfoPolicyDefault info policy that is used when info command policy is null.final QueryPolicyDefault query policy that is used when query command policy is null.final PolicyDefault read policy that is used when read command policy is null.final ScanPolicyDefault scan policy that is used when scan command policy is null.final TxnRollPolicyDefault multi-record transaction (MRT) policy when rolling the transaction records forward (commit) or back (abort) in a batch.final TxnVerifyPolicyDefault multi-record transaction (MRT) policy when verifying record versions in a batch on a commit.final WritePolicyDefault write policy that is used when write command policy is null. -
Constructor Summary
ConstructorsConstructorDescriptionAerospikeClient(ClientPolicy policy, Host... hosts) Initialize Aerospike client with suitable hosts to seed the cluster map.AerospikeClient(ClientPolicy policy, String hostname, int port) Initialize Aerospike client.AerospikeClient(String hostname, int port) Initialize Aerospike client. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidabort(EventLoop eventLoop, AbortListener listener, Txn txn) Asynchronously abort and rollback the given multi-record transaction.final AbortStatusAbort and rollback the given multi-record transaction.final voidadd(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) Asynchronously add integer/double bin values to record bin values.final voidadd(WritePolicy policy, Key key, Bin... bins) Add integer/double bin values to record bin values.final voidappend(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) Asynchronously append bin string values to existing record bin values.final voidappend(WritePolicy policy, Key key, Bin... bins) Append bin string values to existing record bin values.final voidchangePassword(AdminPolicy policy, String user, String password) Change user's password.voidclose()Close all client connections to database server nodes.final voidcommit(EventLoop eventLoop, CommitListener listener, Txn txn) Asynchronously attempt to commit the given multi-record transaction.final CommitStatusAttempt to commit the given multi-record transaction.final BatchDeletePolicyCopy batch detail delete policy default.final BatchPolicyCopy batch header write policy default.final BatchPolicyCopy batch header read policy default.final BatchUDFPolicyCopy batch detail UDF policy default.final BatchWritePolicyCopy batch detail write policy default.final InfoPolicyCopy info command policy default.final QueryPolicyCopy query policy default.final PolicyCopy read policy default.final ScanPolicyCopy scan policy default.final TxnRollPolicyCopy MRT roll forward/back policy default.final TxnVerifyPolicyCopy MRT record version verify policy default.final WritePolicyCopy write policy default.final voidcreateIndex(EventLoop eventLoop, IndexListener listener, Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType, IndexCollectionType indexCollectionType, CTX... ctx) Asynchronously create complex secondary index to be used on bins containing collections.final IndexTaskcreateIndex(Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType) Create scalar secondary index.final IndexTaskcreateIndex(Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType, IndexCollectionType indexCollectionType, CTX... ctx) Create complex secondary index to be used on bins containing collections.final voidcreateRole(AdminPolicy policy, String roleName, List<Privilege> privileges) Create user defined role.final voidcreateRole(AdminPolicy policy, String roleName, List<Privilege> privileges, List<String> whitelist) Create user defined role with optional privileges and whitelist.final voidcreateRole(AdminPolicy policy, String roleName, List<Privilege> privileges, List<String> whitelist, int readQuota, int writeQuota) Create user defined role with optional privileges, whitelist and read/write quotas.final voidcreateUser(AdminPolicy policy, String user, String password, List<String> roles) Create user with password and roles.final voiddelete(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) Asynchronously delete records for specified keys.final voiddelete(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) Asynchronously delete records for specified keys.final voiddelete(EventLoop eventLoop, DeleteListener listener, WritePolicy policy, Key key) Asynchronously delete record for specified key.final BatchResultsdelete(BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) Delete records for specified keys.final booleandelete(WritePolicy policy, Key key) Delete record for specified key.final voidDisable extended periodic cluster and node latency metrics.final voiddropIndex(EventLoop eventLoop, IndexListener listener, Policy policy, String namespace, String setName, String indexName) Asynchronously delete secondary index.final IndexTaskDelete secondary index.final voiddropRole(AdminPolicy policy, String roleName) Drop user defined role.final voiddropUser(AdminPolicy policy, String user) Remove user from cluster.final voidenableMetrics(MetricsPolicy policy) Enable extended periodic cluster and node latency metrics.final voidexecute(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) Asynchronously execute user defined function on server for each key and return results.final voidexecute(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) Asynchronously execute user defined function on server for each key and return results.final voidexecute(EventLoop eventLoop, ExecuteListener listener, WritePolicy policy, Key key, String packageName, String functionName, Value... functionArgs) Asynchronously execute user defined function on server.final BatchResultsexecute(BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) Execute user defined function on server for each key and return results.final Objectexecute(WritePolicy policy, Key key, String packageName, String functionName, Value... functionArgs) Execute user defined function on server and return results.final ExecuteTaskexecute(WritePolicy policy, Statement statement, Operation... operations) Apply operations on records that match the background query statement filter.final ExecuteTaskexecute(WritePolicy policy, Statement statement, String packageName, String functionName, Value... functionArgs) Apply user defined function on records that match the background query statement filter.final voidexists(EventLoop eventLoop, ExistsArrayListener listener, BatchPolicy policy, Key[] keys) Asynchronously check if multiple record keys exist in one batch call.final voidexists(EventLoop eventLoop, ExistsListener listener, Policy policy, Key key) Asynchronously determine if a record key exists.final voidexists(EventLoop eventLoop, ExistsSequenceListener listener, BatchPolicy policy, Key[] keys) Asynchronously check if multiple record keys exist in one batch call.final boolean[]exists(BatchPolicy policy, Key[] keys) Check if multiple record keys exist in one batch call.final booleanDetermine if a record key exists.final voidget(EventLoop eventLoop, BatchListListener listener, BatchPolicy policy, List<BatchRead> records) Asynchronously read multiple records for specified batch keys in one batch call.final voidget(EventLoop eventLoop, BatchSequenceListener listener, BatchPolicy policy, List<BatchRead> records) Asynchronously read multiple records for specified batch keys in one batch call.final voidget(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys) Asynchronously read multiple records for specified keys in one batch call.final voidget(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys, Operation... ops) Asynchronously read multiple records for specified keys using read operations in one batch call.final voidget(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys, String... binNames) Asynchronously read multiple record headers and bins for specified keys in one batch call.final voidget(EventLoop eventLoop, RecordListener listener, Policy policy, Key key) Asynchronously read entire record for specified key.final voidAsynchronously read record header and bins for specified key.final voidget(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys) Asynchronously read multiple records for specified keys in one batch call.final voidget(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys, Operation... ops) Asynchronously read multiple records for specified keys using read operations in one batch call.final voidget(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys, String... binNames) Asynchronously read multiple record headers and bins for specified keys in one batch call.final Record[]get(BatchPolicy policy, Key[] keys) Read multiple records for specified keys in one batch call.final Record[]get(BatchPolicy policy, Key[] keys, Operation... ops) Read multiple records for specified keys using read operations in one batch call.final Record[]get(BatchPolicy policy, Key[] keys, String... binNames) Read multiple record headers and bins for specified keys in one batch call.final booleanget(BatchPolicy policy, List<BatchRead> records) Read multiple records for specified batch keys in one batch call.final RecordRead entire record for specified key.final RecordRead record header and bins for specified key.final BatchDeletePolicyReturn batch detail delete policy default.final BatchPolicyReturn batch header write policy default.final BatchPolicyReturn batch header read policy default.final BatchUDFPolicyReturn batch detail UDF policy default.final BatchWritePolicyReturn batch detail write policy default.final com.aerospike.client.cluster.ClusterReturn operating cluster.final ClusterStatsReturn operating cluster statistics snapshot.final voidgetClusterStats(ClusterStatsListener listener) Asynchronously return operating cluster statistics snapshot.final voidgetHeader(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys) Asynchronously read multiple record header data for specified keys in one batch call.final voidgetHeader(EventLoop eventLoop, RecordListener listener, Policy policy, Key key) Asynchronously read record generation and expiration only for specified key.final voidgetHeader(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys) Asynchronously read multiple record header data for specified keys in one batch call.final Record[]getHeader(BatchPolicy policy, Key[] keys) Read multiple record header data for specified keys in one batch call.final RecordRead record generation and expiration only for specified key.final InfoPolicyReturn info command policy default.final NodeReturn node given its name.Return list of active server node names in the cluster.final Node[]getNodes()Return array of active server nodes in the cluster.final QueryPolicyReturn query policy default.final PolicyReturn read policy default.final ScanPolicyReturn scan policy default.final TxnRollPolicyReturn MRT roll forward/back policy default.final TxnVerifyPolicyReturn MRT record version verify policy default.final WritePolicyReturn write policy default.final voidgrantPrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) Grant privileges to an user defined role.final voidgrantRoles(AdminPolicy policy, String user, List<String> roles) Add roles to user's list of roles.final voidinfo(EventLoop eventLoop, InfoListener listener, InfoPolicy policy, Node node, String... commands) Asynchronously make info commands.final booleanDetermine if we are ready to talk to the database server cluster.final voidoperate(EventLoop eventLoop, BatchOperateListListener listener, BatchPolicy policy, List<BatchRecord> records) Asynchronously read/write multiple records for specified batch keys in one batch call.final voidoperate(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) Asynchronously perform read/write operations on multiple keys.final voidoperate(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) Asynchronously perform read/write operations on multiple keys.final voidoperate(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy policy, List<BatchRecord> records) Asynchronously read/write multiple records for specified batch keys in one batch call.final voidoperate(EventLoop eventLoop, RecordListener listener, WritePolicy policy, Key key, Operation... operations) Asynchronously perform multiple read/write operations on a single key in one batch call.final BatchResultsoperate(BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) Perform read/write operations on multiple keys.final booleanoperate(BatchPolicy policy, List<BatchRecord> records) Read/Write multiple records for specified batch keys in one batch call.final Recordoperate(WritePolicy policy, Key key, Operation... operations) Perform multiple read/write operations on a single key in one batch call.final voidprepend(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) Asynchronously prepend bin string values to existing record bin values.final voidprepend(WritePolicy policy, Key key, Bin... bins) Prepend bin string values to existing record bin values.final voidput(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) Asynchronously write record bin(s).final voidput(WritePolicy policy, Key key, Bin... bins) Write record bin(s).final voidquery(EventLoop eventLoop, RecordSequenceListener listener, QueryPolicy policy, Statement statement) Asynchronously execute query on all server nodes.final RecordSetquery(QueryPolicy policy, Statement statement) Execute query on all server nodes and return record iterator.final voidquery(QueryPolicy policy, Statement statement, PartitionFilter partitionFilter, QueryListener listener) Execute query for specified partitions and return records via the listener.final voidquery(QueryPolicy policy, Statement statement, QueryListener listener) Execute query on all server nodes and return records via the listener.final ResultSetqueryAggregate(QueryPolicy policy, Statement statement) Execute query, apply statement's aggregation function, and return result iterator.final ResultSetqueryAggregate(QueryPolicy policy, Statement statement, String packageName, String functionName, Value... functionArgs) Execute query, apply statement's aggregation function, and return result iterator.final ResultSetqueryAggregateNode(QueryPolicy policy, Statement statement, Node node) Execute query on a single server node, apply statement's aggregation function, and return result iterator.final RecordSetqueryNode(QueryPolicy policy, Statement statement, Node node) Execute query on a single server node and return record iterator.final voidqueryPartitions(EventLoop eventLoop, RecordSequenceListener listener, QueryPolicy policy, Statement statement, PartitionFilter partitionFilter) Asynchronously execute query for specified partitions.final RecordSetqueryPartitions(QueryPolicy policy, Statement statement, PartitionFilter partitionFilter) Execute query for specified partitions and return record iterator.final RolequeryRole(AdminPolicy policy, String roleName) Retrieve role definition.queryRoles(AdminPolicy policy) Retrieve all roles.final UserqueryUser(AdminPolicy policy, String user) Retrieve roles for a given user.queryUsers(AdminPolicy policy) Retrieve all users and their roles.final RegisterTaskregister(Policy policy, ClassLoader resourceLoader, String resourcePath, String serverPath, Language language) Register package located in a resource containing user defined functions with server.final RegisterTaskRegister package located in a file containing user defined functions with server.final RegisterTaskregisterUdfString(Policy policy, String code, String serverPath, Language language) Register UDF functions located in a code string with server.final voidremoveUdf(InfoPolicy policy, String serverPath) Remove user defined function from server nodes.final voidrevokePrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) Revoke privileges from an user defined role.final voidrevokeRoles(AdminPolicy policy, String user, List<String> roles) Remove roles from user's list of roles.final voidscanAll(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, String namespace, String setName, String... binNames) Asynchronously read all records in specified namespace and set.final voidscanAll(ScanPolicy policy, String namespace, String setName, ScanCallback callback, String... binNames) Read all records in specified namespace and set.final voidscanNode(ScanPolicy policy, Node node, String namespace, String setName, ScanCallback callback, String... binNames) Read all records in specified namespace and set for one node only.final voidscanNode(ScanPolicy policy, String nodeName, String namespace, String setName, ScanCallback callback, String... binNames) Read all records in specified namespace and set for one node only.final voidscanPartitions(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, PartitionFilter partitionFilter, String namespace, String setName, String... binNames) Asynchronously read records in specified namespace, set and partition filter.final voidscanPartitions(ScanPolicy policy, PartitionFilter partitionFilter, String namespace, String setName, ScanCallback callback, String... binNames) Read records in specified namespace, set and partition filter.final voidsetQuotas(AdminPolicy policy, String roleName, int readQuota, int writeQuota) Set maximum reads/writes per second limits for a role.final voidsetWhitelist(AdminPolicy policy, String roleName, List<String> whitelist) Set IP address whitelist for a role.final voidsetXDRFilter(InfoPolicy policy, String datacenter, String namespace, Expression filter) Set XDR filter for given datacenter name and namespace.final voidtouch(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key) Asynchronously reset record's time to expiration using the policy's expiration.final voidtouch(WritePolicy policy, Key key) Reset record's time to expiration using the policy's expiration.final voidtouched(EventLoop eventLoop, ExistsListener listener, WritePolicy policy, Key key) Asynchronously reset record's time to expiration using the policy's expiration.final booleantouched(WritePolicy policy, Key key) Reset record's time to expiration using the policy's expiration.final voidtruncate(InfoPolicy policy, String ns, String set, Calendar beforeLastUpdate) Remove records in specified namespace/set efficiently.
-
Field Details
-
readPolicyDefault
Default read policy that is used when read command policy is null. -
writePolicyDefault
Default write policy that is used when write command policy is null. -
scanPolicyDefault
Default scan policy that is used when scan command policy is null. -
queryPolicyDefault
Default query policy that is used when query command policy is null. -
batchPolicyDefault
Default parent policy used in batch read commands. Parent policy fields include socketTimeout, totalTimeout, maxRetries, etc... -
batchParentPolicyWriteDefault
Default parent policy used in batch write commands. Parent policy fields include socketTimeout, totalTimeout, maxRetries, etc... -
batchWritePolicyDefault
Default write policy used in batch operate commands. Write policy fields include generation, expiration, durableDelete, etc... -
batchDeletePolicyDefault
Default delete policy used in batch delete commands. -
batchUDFPolicyDefault
Default user defined function policy used in batch UDF execute commands. -
infoPolicyDefault
Default info policy that is used when info command policy is null. -
txnVerifyPolicyDefault
Default multi-record transaction (MRT) policy when verifying record versions in a batch on a commit. -
txnRollPolicyDefault
Default multi-record transaction (MRT) policy when rolling the transaction records forward (commit) or back (abort) in a batch.
-
-
Constructor Details
-
AerospikeClient
Initialize Aerospike client. If the host connection succeeds, the client will:- 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.
- Parameters:
hostname- host nameport- host port- Throws:
AerospikeException- if host connection fails
-
AerospikeClient
Initialize Aerospike client. The client policy is used to set defaults and size internal data structures. If the host connection succeeds, the client will:- 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.
- Parameters:
policy- client configuration parameters, pass in null for defaultshostname- host nameport- host port- Throws:
AerospikeException- if host connection fails
-
AerospikeClient
Initialize Aerospike client with suitable hosts to seed the cluster map. The client policy is used to set defaults and size internal data structures. For the first host connection that succeeds, the client will:- 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.
- Parameters:
policy- client configuration parameters, pass in null for defaultshosts- array of potential hosts to seed the cluster- Throws:
AerospikeException- if all host connections fail
-
-
Method Details
-
getReadPolicyDefault
Return read policy default. Use when the policy will not be modified.- Specified by:
getReadPolicyDefaultin interfaceIAerospikeClient
-
copyReadPolicyDefault
Copy read policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyReadPolicyDefaultin interfaceIAerospikeClient
-
getWritePolicyDefault
Return write policy default. Use when the policy will not be modified.- Specified by:
getWritePolicyDefaultin interfaceIAerospikeClient
-
copyWritePolicyDefault
Copy write policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyWritePolicyDefaultin interfaceIAerospikeClient
-
getScanPolicyDefault
Return scan policy default. Use when the policy will not be modified.- Specified by:
getScanPolicyDefaultin interfaceIAerospikeClient
-
copyScanPolicyDefault
Copy scan policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyScanPolicyDefaultin interfaceIAerospikeClient
-
getQueryPolicyDefault
Return query policy default. Use when the policy will not be modified.- Specified by:
getQueryPolicyDefaultin interfaceIAerospikeClient
-
copyQueryPolicyDefault
Copy query policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyQueryPolicyDefaultin interfaceIAerospikeClient
-
getBatchPolicyDefault
Return batch header read policy default. Use when the policy will not be modified.- Specified by:
getBatchPolicyDefaultin interfaceIAerospikeClient
-
copyBatchPolicyDefault
Copy batch header read policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyBatchPolicyDefaultin interfaceIAerospikeClient
-
getBatchParentPolicyWriteDefault
Return batch header write policy default. Use when the policy will not be modified.- Specified by:
getBatchParentPolicyWriteDefaultin interfaceIAerospikeClient
-
copyBatchParentPolicyWriteDefault
Copy batch header write policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyBatchParentPolicyWriteDefaultin interfaceIAerospikeClient
-
getBatchWritePolicyDefault
Return batch detail write policy default. Use when the policy will not be modified.- Specified by:
getBatchWritePolicyDefaultin interfaceIAerospikeClient
-
copyBatchWritePolicyDefault
Copy batch detail write policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyBatchWritePolicyDefaultin interfaceIAerospikeClient
-
getBatchDeletePolicyDefault
Return batch detail delete policy default. Use when the policy will not be modified.- Specified by:
getBatchDeletePolicyDefaultin interfaceIAerospikeClient
-
copyBatchDeletePolicyDefault
Copy batch detail delete policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyBatchDeletePolicyDefaultin interfaceIAerospikeClient
-
getBatchUDFPolicyDefault
Return batch detail UDF policy default. Use when the policy will not be modified.- Specified by:
getBatchUDFPolicyDefaultin interfaceIAerospikeClient
-
copyBatchUDFPolicyDefault
Copy batch detail UDF policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyBatchUDFPolicyDefaultin interfaceIAerospikeClient
-
getInfoPolicyDefault
Return info command policy default. Use when the policy will not be modified.- Specified by:
getInfoPolicyDefaultin interfaceIAerospikeClient
-
copyInfoPolicyDefault
Copy info command policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyInfoPolicyDefaultin interfaceIAerospikeClient
-
getTxnVerifyPolicyDefault
Return MRT record version verify policy default. Use when the policy will not be modified.- Specified by:
getTxnVerifyPolicyDefaultin interfaceIAerospikeClient
-
copyTxnVerifyPolicyDefault
Copy MRT record version verify policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyTxnVerifyPolicyDefaultin interfaceIAerospikeClient
-
getTxnRollPolicyDefault
Return MRT roll forward/back policy default. Use when the policy will not be modified.- Specified by:
getTxnRollPolicyDefaultin interfaceIAerospikeClient
-
copyTxnRollPolicyDefault
Copy MRT roll forward/back policy default. Use when the policy will be modified for use in a specific command.- Specified by:
copyTxnRollPolicyDefaultin interfaceIAerospikeClient
-
close
public void close()Close all client connections to database server nodes.If event loops are defined, the client will send a cluster close signal to these event loops. The client instance does not initiate shutdown until the pending async commands complete. The close() method, however, will return before shutdown completes if close() is called from an event loop thread. This is done in order to prevent deadlock.
This close() method will wait for shutdown if the current thread is not an event loop thread. It's recommended to call close() from a non event loop thread for this reason.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIAerospikeClient
-
isConnected
public final boolean isConnected()Determine if we are ready to talk to the database server cluster.- Specified by:
isConnectedin interfaceIAerospikeClient- Returns:
trueif cluster is ready,falseif cluster is not ready
-
getNodes
Return array of active server nodes in the cluster.- Specified by:
getNodesin interfaceIAerospikeClient
-
getNodeNames
Return list of active server node names in the cluster.- Specified by:
getNodeNamesin interfaceIAerospikeClient
-
getNode
Return node given its name.- Specified by:
getNodein interfaceIAerospikeClient- Throws:
AerospikeException.InvalidNode- if node does not exist.
-
enableMetrics
Enable extended periodic cluster and node latency metrics.- Specified by:
enableMetricsin interfaceIAerospikeClient
-
disableMetrics
public final void disableMetrics()Disable extended periodic cluster and node latency metrics.- Specified by:
disableMetricsin interfaceIAerospikeClient
-
getClusterStats
Return operating cluster statistics snapshot.- Specified by:
getClusterStatsin interfaceIAerospikeClient
-
getClusterStats
Asynchronously return operating cluster statistics snapshot.- Specified by:
getClusterStatsin interfaceIAerospikeClient
-
getCluster
public final com.aerospike.client.cluster.Cluster getCluster()Return operating cluster.- Specified by:
getClusterin interfaceIAerospikeClient
-
commit
Attempt to commit the given multi-record transaction. First, the expected record versions are sent to the server nodes for verification. If all nodes return success, the transaction is committed. Otherwise, the transaction is aborted.Requires server version 8.0+
- Specified by:
commitin interfaceIAerospikeClient- Parameters:
txn- multi-record transaction- Returns:
- status of the commit on success
- Throws:
AerospikeException.Commit- if verify commit fails
-
commit
public final void commit(EventLoop eventLoop, CommitListener listener, Txn txn) throws AerospikeException Asynchronously attempt to commit the given multi-record transaction. First, the expected record versions are sent to the server nodes for verification. If all nodes return success, the transaction is committed. Otherwise, the transaction is aborted.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.
Requires server version 8.0+
- Specified by:
commitin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultstxn- multi-record transaction- Throws:
AerospikeException- if event loop registration fails
-
abort
Abort and rollback the given multi-record transaction.Requires server version 8.0+
- Specified by:
abortin interfaceIAerospikeClient- Parameters:
txn- multi-record transaction- Returns:
- status of the abort
-
abort
public final void abort(EventLoop eventLoop, AbortListener listener, Txn txn) throws AerospikeException Asynchronously abort and rollback the given multi-record transaction.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.
Requires server version 8.0+
- Specified by:
abortin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultstxn- multi-record transaction- Throws:
AerospikeException- if event loop registration fails
-
put
Write record bin(s). The policy specifies the command timeouts, record expiration and how the command is handled when the record already exists.- Specified by:
putin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if write fails
-
put
public final void put(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) throws AerospikeException Asynchronously write record bin(s). 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.The policy specifies the command timeout, record expiration and how the command is handled when the record already exists.
- Specified by:
putin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if event loop registration fails
-
append
Append bin string values to existing record bin values. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call only works for string values.- Specified by:
appendin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if append fails
-
append
public final void append(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) throws AerospikeException Asynchronously append bin string values to existing record bin values. 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.The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call only works for string values.
- Specified by:
appendin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if event loop registration fails
-
prepend
Prepend bin string values to existing record bin values. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call works only for string values.- Specified by:
prependin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if prepend fails
-
prepend
public final void prepend(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) throws AerospikeException Asynchronously prepend bin string values to existing record bin values. 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.The policy specifies the command timeout, record expiration and how the command is handled when the record already exists. This call only works for string values.
- Specified by:
prependin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if event loop registration fails
-
add
Add integer/double bin values to record bin values. If the record or bin does not exist, the record/bin will be created by default with the value to be added. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists.- Specified by:
addin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if add fails
-
add
public final void add(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) throws AerospikeException Asynchronously add integer/double bin values to record bin values. If the record or bin does not exist, the record/bin will be created by default with the value to be added. The policy specifies the command timeout, record expiration and how the command is handled when the record already exists.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.
- Specified by:
addin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifierbins- array of bin name/value pairs- Throws:
AerospikeException- if event loop registration fails
-
delete
Delete record for specified key. The policy specifies the command timeout.- Specified by:
deletein interfaceIAerospikeClient- Parameters:
policy- delete configuration parameters, pass in null for defaultskey- unique record identifier- Returns:
- whether record existed on server before deletion
- Throws:
AerospikeException- if delete fails
-
delete
public final void delete(EventLoop eventLoop, DeleteListener listener, WritePolicy policy, Key key) throws AerospikeException Asynchronously delete record for specified key. 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.The policy specifies the command timeout.
- Specified by:
deletein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
delete
public final BatchResults delete(BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) throws AerospikeException Delete records for specified keys. If a key is not found, the corresponding resultBatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
deletein interfaceIAerospikeClient- Parameters:
batchPolicy- batch configuration parameters, pass in null for defaultsdeletePolicy- delete configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException.BatchRecordArray- which contains results for keys that did completeAerospikeException
-
delete
public final void delete(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) throws AerospikeException Asynchronously delete records for specified keys. 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.If a key is not found, the corresponding result
BatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
deletein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultsdeletePolicy- delete configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
delete
public final void delete(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) throws AerospikeException Asynchronously delete records for specified keys. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the corresponding result
BatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
deletein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultsdeletePolicy- delete configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
truncate
public final void truncate(InfoPolicy policy, String ns, String set, Calendar beforeLastUpdate) throws AerospikeException Remove records in specified namespace/set efficiently. This method is many orders of magnitude faster than deleting records one at a time.See https://www.aerospike.com/docs/reference/info#truncate
This asynchronous server call may return before the truncation is complete. The user can still write new records after the server call returns because new records will have last update times greater than the truncate cutoff (set at the time of truncate call).
- Specified by:
truncatein interfaceIAerospikeClient- Parameters:
policy- info command configuration parameters, pass in null for defaultsns- required namespaceset- optional set name. Pass in null to delete all sets in namespace.beforeLastUpdate- optional delete records before record last update time. If specified, value must be before the current time. Pass in null to delete all records in namespace/set.- Throws:
AerospikeException- if truncate fails
-
touch
Reset record's time to expiration using the policy's expiration. If the record does not exist, it can't be created because the server deletes empty records. Throw an exception if the record does not exist.- Specified by:
touchin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if touch fails
-
touch
public final void touch(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key) throws AerospikeException Asynchronously reset record's time to expiration using the policy's expiration. If the record does not exist, it can't be created because the server deletes empty records.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.
Fail if the record does not exist.
- Specified by:
touchin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
touched
Reset record's time to expiration using the policy's expiration. If the record does not exist, it can't be created because the server deletes empty records. Return true if the record exists and is touched. Return false if the record does not exist.- Specified by:
touchedin interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if touch fails
-
touched
public final void touched(EventLoop eventLoop, ExistsListener listener, WritePolicy policy, Key key) throws AerospikeException Asynchronously reset record's time to expiration using the policy's expiration. If the record does not exist, it can't be created because the server deletes empty records.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.
If the record does not exist, send a value of false to
ExistsListener.onSuccess(Key, boolean)- Specified by:
touchedin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
exists
Determine if a record key exists. The policy can be used to specify timeouts.- Specified by:
existsin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Returns:
- whether record exists or not
- Throws:
AerospikeException- if command fails
-
exists
public final void exists(EventLoop eventLoop, ExistsListener listener, Policy policy, Key key) throws AerospikeException Asynchronously determine if a record key exists. 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.The policy can be used to specify timeouts.
- Specified by:
existsin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
exists
Check if multiple record keys exist in one batch call. The returned boolean array is in positional order with the original key array order.- Specified by:
existsin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Returns:
- array key/existence status pairs
- Throws:
AerospikeException.BatchExists- which contains results for keys that did completeAerospikeException
-
exists
public final void exists(EventLoop eventLoop, ExistsArrayListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously check if multiple record keys exist in one batch call. 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.The returned boolean array is in positional order with the original key array order.
- Specified by:
existsin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
exists
public final void exists(EventLoop eventLoop, ExistsSequenceListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously check if multiple record keys exist in one batch call. 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.Each key's result is returned in separate onExists() calls.
- Specified by:
existsin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
get
Read entire record for specified key. The policy can be used to specify timeouts.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Returns:
- if found, return record instance. If not found, return null.
- Throws:
AerospikeException- if read fails
-
get
public final void get(EventLoop eventLoop, RecordListener listener, Policy policy, Key key) throws AerospikeException Asynchronously read entire record for specified key. 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.The policy can be used to specify timeouts.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
get
Read record header and bins for specified key. The policy can be used to specify timeouts.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultskey- unique record identifierbinNames- bins to retrieve- Returns:
- if found, return record instance. If not found, return null.
- Throws:
AerospikeException- if read fails
-
get
public final void get(EventLoop eventLoop, RecordListener listener, Policy policy, Key key, String... binNames) throws AerospikeException Asynchronously read record header and bins for specified key. 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.The policy can be used to specify timeouts.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultskey- unique record identifierbinNames- bins to retrieve- Throws:
AerospikeException- if event loop registration fails
-
getHeader
Read record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts.- Specified by:
getHeaderin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Returns:
- if found, return record instance. If not found, return null.
- Throws:
AerospikeException- if read fails
-
getHeader
public final void getHeader(EventLoop eventLoop, RecordListener listener, Policy policy, Key key) throws AerospikeException Asynchronously read record generation and expiration only for specified key. Bins are not read. 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.The policy can be used to specify timeouts.
- Specified by:
getHeaderin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultskey- unique record identifier- Throws:
AerospikeException- if event loop registration fails
-
get
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 BatchRead key field is not found, the corresponding record field will be null.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and the bins to retrieve. The returned records are located in the same list.- Returns:
- true if all batch key requests succeeded
- Throws:
AerospikeException- if read fails
-
get
public final void get(EventLoop eventLoop, BatchListListener listener, BatchPolicy policy, List<BatchRead> records) throws AerospikeException Asynchronously read multiple records for specified batch keys in one batch call. 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.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 BatchRead key field is not found, the corresponding record field will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and the bins to retrieve. The returned records are located in the same list.- Throws:
AerospikeException- if event loop registration fails
-
get
public final void get(EventLoop eventLoop, BatchSequenceListener listener, BatchPolicy policy, List<BatchRead> records) throws AerospikeException Asynchronously read multiple records for specified batch keys in one batch call. 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.This method allows different namespaces/bins to be requested for each key in the batch. Each record result is returned in separate onRecord() calls. If the BatchRead key field is not found, the corresponding record field will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and the bins to retrieve. The returned records are located in the same list.- Throws:
AerospikeException- if event loop registration fails
-
get
Read multiple records for specified keys in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Returns:
- array of records
- Throws:
AerospikeException.BatchRecords- which contains results for keys that did completeAerospikeException
-
get
public final void get(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously read multiple records for specified keys in one batch call. 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.The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
get
public final void get(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously read multiple records for specified keys in one batch call. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
get
public final Record[] get(BatchPolicy policy, Key[] keys, String... binNames) throws AerospikeException Read multiple record headers and bins for specified keys in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersbinNames- array of bins to retrieve- Returns:
- array of records
- Throws:
AerospikeException.BatchRecords- which contains results for keys that did completeAerospikeException
-
get
public final void get(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys, String... binNames) throws AerospikeException Asynchronously read multiple record headers and bins for specified keys in one batch call. 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.The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersbinNames- array of bins to retrieve- Throws:
AerospikeException- if event loop registration fails
-
get
public final void get(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys, String... binNames) throws AerospikeException Asynchronously read multiple record headers and bins for specified keys in one batch call. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersbinNames- array of bins to retrieve- Throws:
AerospikeException- if event loop registration fails
-
get
public final Record[] get(BatchPolicy policy, Key[] keys, Operation... ops) throws AerospikeException Read multiple records for specified keys using read operations in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.- Specified by:
getin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- array of read operations on record- Returns:
- array of records
- Throws:
AerospikeException.BatchRecords- which contains results for keys that did completeAerospikeException
-
get
public final void get(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys, Operation... ops) throws AerospikeException Asynchronously read multiple records for specified keys using read operations in one batch call. 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.The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- array of read operations on record- Throws:
AerospikeException- if event loop registration fails
-
get
public final void get(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys, Operation... ops) throws AerospikeException Asynchronously read multiple records for specified keys using read operations in one batch call. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the record will be null.
- Specified by:
getin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- array of read operations on record- Throws:
AerospikeException- if event loop registration fails
-
getHeader
Read multiple record header data for specified keys in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.- Specified by:
getHeaderin interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Returns:
- array of records
- Throws:
AerospikeException.BatchRecords- which contains results for keys that did completeAerospikeException
-
getHeader
public final void getHeader(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously read multiple record header data for specified keys in one batch call. 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.The returned records are in positional order with the original key array order. If a key is not found, the positional record will be null.
- Specified by:
getHeaderin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
getHeader
public final void getHeader(EventLoop eventLoop, RecordSequenceListener listener, BatchPolicy policy, Key[] keys) throws AerospikeException Asynchronously read multiple record header data for specified keys in one batch call. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the record will be null.
- Specified by:
getHeaderin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultskeys- array of unique record identifiers- Throws:
AerospikeException- if event loop registration fails
-
operate
public final Record operate(WritePolicy policy, Key key, Operation... operations) throws AerospikeException Perform multiple read/write operations on a single key in one batch call. An example would be to add an integer value to an existing record and then read the result, all in one database call.The server executes operations in the same order as the operations array. Both scalar bin operations (Operation) and CDT bin operations (ListOperation, MapOperation) can be performed in same call.
Operation results are stored with their associated bin name in the returned record. The bin's result type will be a list when multiple operations occur on the same bin.
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifieroperations- database operations to perform- Returns:
- record results
- Throws:
AerospikeException- if command fails
-
operate
public final void operate(EventLoop eventLoop, RecordListener listener, WritePolicy policy, Key key, Operation... operations) throws AerospikeException Asynchronously perform multiple read/write operations on a single key in one batch call. 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.An example would be to add an integer value to an existing record and then read the result, all in one database call.
The server executes operations in the same order as the operations array. Both scalar bin operations (Operation) and CDT bin operations (ListOperation, MapOperation) can be performed in same call.
Operation results are stored with their associated bin name in the returned record. The bin's result type will be a list when multiple operations occur on the same bin.
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifieroperations- database operations to perform- Throws:
AerospikeException- if event loop registration fails
-
operate
public final boolean operate(BatchPolicy policy, List<BatchRecord> records) throws AerospikeException Read/Write multiple records for specified batch keys in one batch call. This method allows different namespaces/bins for each key in the batch. The returned records are located in the same list.BatchRecordcan beBatchRead,BatchWrite,BatchDeleteorBatchUDF.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
policy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and read/write operations- Returns:
- true if all batch sub-commands succeeded
- Throws:
AerospikeException- if command fails
-
operate
public final void operate(EventLoop eventLoop, BatchOperateListListener listener, BatchPolicy policy, List<BatchRecord> records) throws AerospikeException Asynchronously read/write multiple records for specified batch keys in one batch call. 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.This method allows different namespaces/bins to be requested for each key in the batch. The returned records are located in the same list.
BatchRecordcan beBatchRead,BatchWrite,BatchDeleteorBatchUDF.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and read/write operations- Throws:
AerospikeException- if event loop registration fails
-
operate
public final void operate(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy policy, List<BatchRecord> records) throws AerospikeException Asynchronously read/write multiple records for specified batch keys in one batch call. 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.This method allows different namespaces/bins to be requested for each key in the batch. Each record result is returned in separate onRecord() calls.
BatchRecordcan beBatchRead,BatchWrite,BatchDeleteorBatchUDF.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- batch configuration parameters, pass in null for defaultsrecords- list of unique record identifiers and read/write operations- Throws:
AerospikeException- if event loop registration fails
-
operate
public final BatchResults operate(BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) throws AerospikeException Perform read/write operations on multiple keys. If a key is not found, the corresponding resultBatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
batchPolicy- batch configuration parameters, pass in null for defaultswritePolicy- write configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- read/write operations to perform.Operation.get()is not allowed because it returns a variable number of bins and makes it difficult (sometimes impossible) to lineup operations with results. Instead, useOperation.get(String)for each bin name.- Throws:
AerospikeException.BatchRecordArray- which contains results for keys that did completeAerospikeException
-
operate
public final void operate(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) throws AerospikeException Asynchronously perform read/write operations on multiple keys. 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.If a key is not found, the corresponding result
BatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultswritePolicy- write configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- read/write operations to perform.Operation.get()is not allowed because it returns a variable number of bins and makes it difficult (sometimes impossible) to lineup operations with results. Instead, useOperation.get(String)for each bin name.- Throws:
AerospikeException- if event loop registration fails
-
operate
public final void operate(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchWritePolicy writePolicy, Key[] keys, Operation... ops) throws AerospikeException Asynchronously perform read/write operations on multiple keys. 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.Each record result is returned in separate onRecord() calls. If a key is not found, the corresponding result
BatchRecord.resultCodewill beResultCode.KEY_NOT_FOUND_ERROR.Requires server version 6.0+
- Specified by:
operatein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultswritePolicy- write configuration parameters, pass in null for defaultskeys- array of unique record identifiersops- read/write operations to perform.Operation.get()is not allowed because it returns a variable number of bins and makes it difficult (sometimes impossible) to lineup operations with results. Instead, useOperation.get(String)for each bin name.- Throws:
AerospikeException- if event loop registration fails
-
scanAll
public final void scanAll(ScanPolicy policy, String namespace, String setName, ScanCallback callback, String... binNames) throws AerospikeException Read all records in specified namespace and set. If the policy'sconcurrentNodesis specified, each server node will be read in parallel. Otherwise, server nodes are read in series.This call will block until the scan is complete - callbacks are made within the scope of this call.
- Specified by:
scanAllin interfaceIAerospikeClient- Parameters:
policy- scan configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablecallback- read callback method - called with record databinNames- optional bin to retrieve. All bins will be returned if not specified.- Throws:
AerospikeException- if scan fails
-
scanAll
public final void scanAll(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, String namespace, String setName, String... binNames) throws AerospikeException Asynchronously read all records in specified namespace and set. If the policy'sconcurrentNodesis specified, each server node will be read in parallel. Otherwise, server nodes are read in series.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.
- Specified by:
scanAllin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- scan configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablebinNames- optional bin to retrieve. All bins will be returned if not specified.- Throws:
AerospikeException- if event loop registration fails
-
scanNode
public final void scanNode(ScanPolicy policy, String nodeName, String namespace, String setName, ScanCallback callback, String... binNames) throws AerospikeException Read all records in specified namespace and set for one node only. The node is specified by name.This call will block until the scan is complete - callbacks are made within the scope of this call.
- Specified by:
scanNodein interfaceIAerospikeClient- Parameters:
policy- scan configuration parameters, pass in null for defaultsnodeName- server node namenamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablecallback- read callback method - called with record databinNames- optional bin to retrieve. All bins will be returned if not specified.- Throws:
AerospikeException- if scan fails
-
scanNode
public final void scanNode(ScanPolicy policy, Node node, String namespace, String setName, ScanCallback callback, String... binNames) throws AerospikeException Read all records in specified namespace and set for one node only.This call will block until the scan is complete - callbacks are made within the scope of this call.
- Specified by:
scanNodein interfaceIAerospikeClient- Parameters:
policy- scan configuration parameters, pass in null for defaultsnode- server nodenamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablecallback- read callback method - called with record databinNames- optional bin to retrieve. All bins will be returned if not specified.- Throws:
AerospikeException- if scan fails
-
scanPartitions
public final void scanPartitions(ScanPolicy policy, PartitionFilter partitionFilter, String namespace, String setName, ScanCallback callback, String... binNames) throws AerospikeException Read records in specified namespace, set and partition filter.This call will block until the scan is complete - callbacks are made within the scope of this call.
- Specified by:
scanPartitionsin interfaceIAerospikeClient- Parameters:
policy- scan configuration parameters, pass in null for defaultspartitionFilter- filter on a subset of data partitionsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablecallback- read callback method - called with record databinNames- optional bin to retrieve. All bins will be returned if not specified- Throws:
AerospikeException- if scan fails
-
scanPartitions
public final void scanPartitions(EventLoop eventLoop, RecordSequenceListener listener, ScanPolicy policy, PartitionFilter partitionFilter, String namespace, String setName, String... binNames) throws AerospikeException Asynchronously read records in specified namespace, set and partition filter.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.
- Specified by:
scanPartitionsin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- scan configuration parameters, pass in null for defaultspartitionFilter- filter on a subset of data partitionsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tablebinNames- optional bin to retrieve. All bins will be returned if not specified.- Throws:
AerospikeException- if event loop registration fails
-
register
public final RegisterTask register(Policy policy, String clientPath, String serverPath, Language language) throws AerospikeException Register package located in a file containing user defined functions with server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.- Specified by:
registerin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultsclientPath- path of client file containing user defined functions, relative to current directoryserverPath- path to store user defined functions on the server, relative to configured script directory.language- language of user defined functions- Throws:
AerospikeException- if register fails
-
register
public final RegisterTask register(Policy policy, ClassLoader resourceLoader, String resourcePath, String serverPath, Language language) throws AerospikeException Register package located in a resource containing user defined functions with server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.- Specified by:
registerin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultsresourceLoader- class loader where resource is located. Example: MyClass.class.getClassLoader() or Thread.currentThread().getContextClassLoader() for webappsresourcePath- class path where Lua resource is locatedserverPath- path to store user defined functions on the server, relative to configured script directory.language- language of user defined functions- Throws:
AerospikeException- if register fails
-
registerUdfString
public final RegisterTask registerUdfString(Policy policy, String code, String serverPath, Language language) throws AerospikeException Register UDF functions located in a code string with server. Example:String code = "local function reducer(val1,val2)\n" + " return val1 + val2\n" + "end\n" + "\n" + "function sum_single_bin(stream,name)\n" + " local function mapper(rec)\n" + " return rec[name]\n" + " end\n" + " return stream : map(mapper) : reduce(reducer)\n" + "end\n"; client.registerUdfString(null, code, "mysum.lua", Language.LUA);This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.
- Specified by:
registerUdfStringin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultscode- code string containing user defined functions.serverPath- path to store user defined functions on the server, relative to configured script directory.language- language of user defined functions- Throws:
AerospikeException- if register fails
-
removeUdf
Remove user defined function from server nodes.- Specified by:
removeUdfin interfaceIAerospikeClient- Parameters:
policy- info configuration parameters, pass in null for defaultsserverPath- location of UDF on server nodes. Example: mylua.lua- Throws:
AerospikeException- if remove fails
-
execute
public final Object execute(WritePolicy policy, Key key, String packageName, String functionName, Value... functionArgs) throws AerospikeException Execute user defined function on server and return results. The function operates on a single record. The package name is used to locate the udf file location:udf file = <server udf dir>/<package name>.lua- Specified by:
executein interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultskey- unique record identifierpackageName- server package name where user defined function residesfunctionName- user defined functionfunctionArgs- arguments passed in to user defined function- Returns:
- return value of user defined function
- Throws:
AerospikeException- if command fails
-
execute
public final void execute(EventLoop eventLoop, ExecuteListener listener, WritePolicy policy, Key key, String packageName, String functionName, Value... functionArgs) throws AerospikeException Asynchronously execute user defined function on server. 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.The function operates on a single record. The package name is used to locate the udf file location:
udf file = <server udf dir>/<package name>.lua- Specified by:
executein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send results, pass in null for fire and forgetpolicy- write configuration parameters, pass in null for defaultskey- unique record identifierpackageName- server package name where user defined function residesfunctionName- user defined functionfunctionArgs- arguments passed in to user defined function- Throws:
AerospikeException- if event loop registration fails
-
execute
public final BatchResults execute(BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) throws AerospikeException Execute user defined function on server for each key and return results. The package name is used to locate the udf file location:udf file = <server udf dir>/<package name>.luaRequires server version 6.0+
- Specified by:
executein interfaceIAerospikeClient- Parameters:
batchPolicy- batch configuration parameters, pass in null for defaultsudfPolicy- udf configuration parameters, pass in null for defaultskeys- array of unique record identifierspackageName- server package name where user defined function residesfunctionName- user defined functionfunctionArgs- arguments passed in to user defined function- Throws:
AerospikeException.BatchRecordArray- which contains results for keys that did completeAerospikeException
-
execute
public final void execute(EventLoop eventLoop, BatchRecordArrayListener listener, BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) throws AerospikeException Asynchronously execute user defined function on server for each key and return results. 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.The package name is used to locate the udf file location:
udf file = <server udf dir>/<package name>.luaRequires server version 6.0+
- Specified by:
executein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultsudfPolicy- udf configuration parameters, pass in null for defaultskeys- array of unique record identifierspackageName- server package name where user defined function residesfunctionName- user defined functionfunctionArgs- arguments passed in to user defined function- Throws:
AerospikeException- if command fails
-
execute
public final void execute(EventLoop eventLoop, BatchRecordSequenceListener listener, BatchPolicy batchPolicy, BatchUDFPolicy udfPolicy, Key[] keys, String packageName, String functionName, Value... functionArgs) throws AerospikeException Asynchronously execute user defined function on server for each key and return results. 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. Each record result is returned in separate onRecord() calls.The package name is used to locate the udf file location:
udf file = <server udf dir>/<package name>.luaRequires server version 6.0+
- Specified by:
executein interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultsbatchPolicy- batch configuration parameters, pass in null for defaultsudfPolicy- udf configuration parameters, pass in null for defaultskeys- array of unique record identifierspackageName- server package name where user defined function residesfunctionName- user defined functionfunctionArgs- arguments passed in to user defined function- Throws:
AerospikeException- if command fails
-
execute
public final ExecuteTask execute(WritePolicy policy, Statement statement, String packageName, String functionName, Value... functionArgs) throws AerospikeException Apply user defined function on records that match the background query statement filter. Records are not returned to the client. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.- Specified by:
executein interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultsstatement- background query definitionpackageName- server package where user defined function residesfunctionName- function namefunctionArgs- to pass to function name, if any- Throws:
AerospikeException- if command fails
-
execute
public final ExecuteTask execute(WritePolicy policy, Statement statement, Operation... operations) throws AerospikeException Apply operations on records that match the background query statement filter. Records are not returned to the client. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.- Specified by:
executein interfaceIAerospikeClient- Parameters:
policy- write configuration parameters, pass in null for defaultsstatement- background query definitionoperations- list of operations to be performed on selected records- Throws:
AerospikeException- if command fails
-
query
Execute query on all server nodes and return record iterator. The query executor puts records on a queue in separate threads. The calling thread concurrently pops records off the queue through the record iterator.This method is not recommended for paginated queries when the user does not iterate through all records in the RecordSet. In this case, there is a lag between when the client marks the last record retrieved from the server and when the record is retrieved from the RecordSet. For this case, use
query(QueryPolicy, Statement, QueryListener)which uses a listener callback (without a buffer) instead of a RecordSet.- Specified by:
queryin interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definition- Returns:
- record iterator
- Throws:
AerospikeException- if query fails
-
query
public final void query(EventLoop eventLoop, RecordSequenceListener listener, QueryPolicy policy, Statement statement) throws AerospikeException Asynchronously execute query on all server nodes. 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.Each record result is returned in separate onRecord() calls.
- Specified by:
queryin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- query configuration parameters, pass in null for defaultsstatement- query definition- Throws:
AerospikeException- if event loop registration fails
-
query
public final void query(QueryPolicy policy, Statement statement, QueryListener listener) throws AerospikeException Execute query on all server nodes and return records via the listener. This method will block until the query is complete. Listener callbacks are made within the scope of this call.If
QueryPolicy.maxConcurrentNodesis not 1, the supplied listener must handle shared data in a thread-safe manner, because the listener will be called by multiple query threads (one thread per node) in parallel.Requires server version 6.0+ if using a secondary index query.
- Specified by:
queryin interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionlistener- where to send results- Throws:
AerospikeException- if query fails
-
query
public final void query(QueryPolicy policy, Statement statement, PartitionFilter partitionFilter, QueryListener listener) throws AerospikeException Execute query for specified partitions and return records via the listener. This method will block until the query is complete. Listener callbacks are made within the scope of this call.If
QueryPolicy.maxConcurrentNodesis not 1, the supplied listener must handle shared data in a thread-safe manner, because the listener will be called by multiple query threads (one thread per node) in parallel.The completion status of all partitions is stored in the partitionFilter when the query terminates. This partitionFilter can then be used to resume an incomplete query at a later time. This is the preferred method for query terminate/resume functionality.
Requires server version 6.0+ if using a secondary index query.
- Specified by:
queryin interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionpartitionFilter- data partition filter. Set toPartitionFilter.all()for all partitions.listener- where to send results- Throws:
AerospikeException- if query fails
-
queryNode
public final RecordSet queryNode(QueryPolicy policy, Statement statement, Node node) throws AerospikeException Execute query on a single server node and return record iterator. The query executor puts records on a queue in a separate thread. The calling thread concurrently pops records off the queue through the record iterator.- Specified by:
queryNodein interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionnode- server node to execute query- Returns:
- record iterator
- Throws:
AerospikeException- if query fails
-
queryPartitions
public final RecordSet queryPartitions(QueryPolicy policy, Statement statement, PartitionFilter partitionFilter) throws AerospikeException Execute query for specified partitions and return record iterator. The query executor puts records on a queue in separate threads. The calling thread concurrently pops records off the queue through the record iterator.Requires server version 6.0+ if using a secondary index query.
- Specified by:
queryPartitionsin interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionpartitionFilter- filter on a subset of data partitions- Throws:
AerospikeException- if query fails
-
queryPartitions
public final void queryPartitions(EventLoop eventLoop, RecordSequenceListener listener, QueryPolicy policy, Statement statement, PartitionFilter partitionFilter) throws AerospikeException Asynchronously execute query for specified partitions. 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.Each record result is returned in separate onRecord() calls.
Requires server version 6.0+ if using a secondary index query.
- Specified by:
queryPartitionsin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- query configuration parameters, pass in null for defaultsstatement- query definitionpartitionFilter- filter on a subset of data partitions- Throws:
AerospikeException- if query fails
-
queryAggregate
public final ResultSet queryAggregate(QueryPolicy policy, Statement statement, String packageName, String functionName, Value... functionArgs) throws AerospikeException Execute query, apply statement's aggregation function, and return result iterator. The query executor puts results on a queue in separate threads. The calling thread concurrently pops results off the queue through the result iterator.The aggregation function is called on both server and client (final reduce). Therefore, the Lua script files must also reside on both server and client. The package name is used to locate the udf file location:
udf file = <udf dir>/<package name>.lua- Specified by:
queryAggregatein interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionpackageName- server package where user defined function residesfunctionName- aggregation function namefunctionArgs- arguments to pass to function name, if any- Returns:
- result iterator
- Throws:
AerospikeException- if query fails
-
queryAggregate
public final ResultSet queryAggregate(QueryPolicy policy, Statement statement) throws AerospikeException 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 resource or a filesystem file.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.
- Specified by:
queryAggregatein interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definition- Throws:
AerospikeException- if query fails
-
queryAggregateNode
public final ResultSet queryAggregateNode(QueryPolicy policy, Statement statement, Node node) throws AerospikeException Execute query on a single server node, 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 resource or a filesystem file.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.
- Specified by:
queryAggregateNodein interfaceIAerospikeClient- Parameters:
policy- query configuration parameters, pass in null for defaultsstatement- query definitionnode- server node to execute query- Throws:
AerospikeException- if query fails
-
createIndex
public final IndexTask createIndex(Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType) throws AerospikeException Create scalar secondary index. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned IndexTask instance.- Specified by:
createIndexin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tableindexName- name of secondary indexbinName- bin name that data is indexed onindexType- underlying data type of secondary index- Throws:
AerospikeException- if index create fails
-
createIndex
public final IndexTask createIndex(Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType, IndexCollectionType indexCollectionType, CTX... ctx) throws AerospikeException Create complex secondary index to be used on bins containing collections. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned IndexTask instance.- Specified by:
createIndexin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tableindexName- name of secondary indexbinName- bin name that data is indexed onindexType- underlying data type of secondary indexindexCollectionType- index collection typectx- optional context to index on elements within a CDT- Throws:
AerospikeException- if index create fails
-
createIndex
public final void createIndex(EventLoop eventLoop, IndexListener listener, Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType, IndexCollectionType indexCollectionType, CTX... ctx) throws AerospikeException Asynchronously create complex secondary index to be used on bins containing collections. 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.- Specified by:
createIndexin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tableindexName- name of secondary indexbinName- bin name that data is indexed onindexType- underlying data type of secondary indexindexCollectionType- index collection typectx- optional context to index on elements within a CDT- Throws:
AerospikeException- if index create fails
-
dropIndex
public final IndexTask dropIndex(Policy policy, String namespace, String setName, String indexName) throws AerospikeException Delete secondary index. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned IndexTask instance.- Specified by:
dropIndexin interfaceIAerospikeClient- Parameters:
policy- generic configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tableindexName- name of secondary index- Throws:
AerospikeException- if index drop fails
-
dropIndex
public final void dropIndex(EventLoop eventLoop, IndexListener listener, Policy policy, String namespace, String setName, String indexName) throws AerospikeException Asynchronously delete secondary index. 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.- Specified by:
dropIndexin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- generic configuration parameters, pass in null for defaultsnamespace- namespace - equivalent to database namesetName- optional set name - equivalent to database tableindexName- name of secondary index- Throws:
AerospikeException- if index drop fails
-
info
public final void info(EventLoop eventLoop, InfoListener listener, InfoPolicy policy, Node node, String... commands) throws AerospikeException Asynchronously make info commands. 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.The info protocol is a name/value pair based system, where an individual database server node is queried to determine its configuration and status. The list of supported info commands can be found at: https://www.aerospike.com/docs/reference/info/index.html
- Specified by:
infoin interfaceIAerospikeClient- Parameters:
eventLoop- event loop that will process the command. If NULL, the event loop will be chosen by round-robin.listener- where to send resultspolicy- info configuration parameters, pass in null for defaultsnode- server node to execute command, pass in null for random nodecommands- list of info commands- Throws:
AerospikeException- if info commands fail
-
setXDRFilter
public final void setXDRFilter(InfoPolicy policy, String datacenter, String namespace, Expression filter) throws AerospikeException Set XDR filter for given datacenter name and namespace. The expression filter indicates which records XDR should ship to the datacenter. If the expression filter is null, the XDR filter will be removed.- Specified by:
setXDRFilterin interfaceIAerospikeClient- Parameters:
policy- info configuration parameters, pass in null for defaultsdatacenter- XDR datacenter namenamespace- namespace - equivalent to database namefilter- expression filter- Throws:
AerospikeException- if command fails
-
createUser
public final void createUser(AdminPolicy policy, String user, String password, List<String> roles) throws AerospikeException Create user with password and roles. Clear-text password will be hashed using bcrypt before sending to server.- Specified by:
createUserin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user namepassword- user password in clear-text formatroles- variable arguments array of role names. Predefined roles are listed inRole- Throws:
AerospikeException- if command fails
-
dropUser
Remove user from cluster.- Specified by:
dropUserin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user name- Throws:
AerospikeException- if command fails
-
changePassword
public final void changePassword(AdminPolicy policy, String user, String password) throws AerospikeException Change user's password.- Specified by:
changePasswordin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user namepassword- user password in clear-text format- Throws:
AerospikeException- if command fails
-
grantRoles
public final void grantRoles(AdminPolicy policy, String user, List<String> roles) throws AerospikeException Add roles to user's list of roles.- Specified by:
grantRolesin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user nameroles- role names. Predefined roles are listed inRole- Throws:
AerospikeException- if command fails
-
revokeRoles
public final void revokeRoles(AdminPolicy policy, String user, List<String> roles) throws AerospikeException Remove roles from user's list of roles.- Specified by:
revokeRolesin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user nameroles- role names. Predefined roles are listed inRole- Throws:
AerospikeException- if command fails
-
createRole
public final void createRole(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException Create user defined role.- Specified by:
createRolein interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role nameprivileges- privileges assigned to the role.- Throws:
AerospikeException- if command fails
-
createRole
public final void createRole(AdminPolicy policy, String roleName, List<Privilege> privileges, List<String> whitelist) throws AerospikeException Create user defined role with optional privileges and whitelist.- Specified by:
createRolein interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role nameprivileges- optional list of privileges assigned to role.whitelist- optional list of allowable IP addresses assigned to role. IP addresses can contain wildcards (ie. 10.1.2.0/24).- Throws:
AerospikeException- if command fails
-
createRole
public final void createRole(AdminPolicy policy, String roleName, List<Privilege> privileges, List<String> whitelist, int readQuota, int writeQuota) throws AerospikeException Create user defined role with optional privileges, whitelist and read/write quotas. Quotas require server security configuration "enable-quotas" to be set to true.- Specified by:
createRolein interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role nameprivileges- optional list of privileges assigned to role.whitelist- optional list of allowable IP addresses assigned to role. IP addresses can contain wildcards (ie. 10.1.2.0/24).readQuota- optional maximum reads per second limit, pass in zero for no limit.writeQuota- optional maximum writes per second limit, pass in zero for no limit.- Throws:
AerospikeException- if command fails
-
dropRole
Drop user defined role.- Specified by:
dropRolein interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role name- Throws:
AerospikeException- if command fails
-
grantPrivileges
public final void grantPrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException Grant privileges to an user defined role.- Specified by:
grantPrivilegesin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role nameprivileges- privileges assigned to the role.- Throws:
AerospikeException- if command fails
-
revokePrivileges
public final void revokePrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException Revoke privileges from an user defined role.- Specified by:
revokePrivilegesin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role nameprivileges- privileges assigned to the role.- Throws:
AerospikeException- if command fails
-
setWhitelist
public final void setWhitelist(AdminPolicy policy, String roleName, List<String> whitelist) throws AerospikeException Set IP address whitelist for a role. If whitelist is null or empty, remove existing whitelist from role.- Specified by:
setWhitelistin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role namewhitelist- list of allowable IP addresses or null. IP addresses can contain wildcards (ie. 10.1.2.0/24).- Throws:
AerospikeException- if command fails
-
setQuotas
public final void setQuotas(AdminPolicy policy, String roleName, int readQuota, int writeQuota) throws AerospikeException Set maximum reads/writes per second limits for a role. If a quota is zero, the limit is removed. Quotas require server security configuration "enable-quotas" to be set to true.- Specified by:
setQuotasin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role namereadQuota- maximum reads per second limit, pass in zero for no limit.writeQuota- maximum writes per second limit, pass in zero for no limit.- Throws:
AerospikeException- if command fails
-
queryUser
Retrieve roles for a given user.- Specified by:
queryUserin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsuser- user name filter- Throws:
AerospikeException- if command fails
-
queryUsers
Retrieve all users and their roles.- Specified by:
queryUsersin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaults- Throws:
AerospikeException- if command fails
-
queryRole
Retrieve role definition.- Specified by:
queryRolein interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaultsroleName- role name filter- Throws:
AerospikeException- if command fails
-
queryRoles
Retrieve all roles.- Specified by:
queryRolesin interfaceIAerospikeClient- Parameters:
policy- admin configuration parameters, pass in null for defaults- Throws:
AerospikeException- if command fails
-