Interface IAerospikeClient

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AerospikeClient

public interface IAerospikeClient extends Closeable
This interface's sole purpose is to allow mock frameworks to operate on AerospikeClient without being constrained by final methods.
  • Method Details

    • getReadPolicyDefault

      Policy getReadPolicyDefault()
    • getWritePolicyDefault

      WritePolicy getWritePolicyDefault()
    • getScanPolicyDefault

      ScanPolicy getScanPolicyDefault()
    • getQueryPolicyDefault

      QueryPolicy getQueryPolicyDefault()
    • getBatchPolicyDefault

      BatchPolicy getBatchPolicyDefault()
    • getBatchParentPolicyWriteDefault

      BatchPolicy getBatchParentPolicyWriteDefault()
    • getBatchWritePolicyDefault

      BatchWritePolicy getBatchWritePolicyDefault()
    • getBatchDeletePolicyDefault

      BatchDeletePolicy getBatchDeletePolicyDefault()
    • getBatchUDFPolicyDefault

      BatchUDFPolicy getBatchUDFPolicyDefault()
    • getInfoPolicyDefault

      InfoPolicy getInfoPolicyDefault()
    • close

      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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • isConnected

      boolean isConnected()
      Determine if we are ready to talk to the database server cluster.
      Returns:
      true if cluster is ready, false if cluster is not ready
    • getNodes

      Node[] getNodes()
      Return array of active server nodes in the cluster.
    • getNodeNames

      List<String> getNodeNames()
      Return list of active server node names in the cluster.
    • getNode

      Node getNode(String nodeName) throws AerospikeException.InvalidNode
      Return node given its name.
      Throws:
      AerospikeException.InvalidNode - if node does not exist.
    • enableMetrics

      void enableMetrics(com.aerospike.client.metrics.MetricsPolicy policy)
      Enable extended periodic cluster and node latency metrics.
    • disableMetrics

      void disableMetrics()
      Disable extended periodic cluster and node latency metrics.
    • getClusterStats

      ClusterStats getClusterStats()
      Return operating cluster statistics snapshot.
    • getClusterStats

      void getClusterStats(ClusterStatsListener listener)
      Asynchronously return operating cluster statistics snapshot.
    • getCluster

      com.aerospike.client.cluster.Cluster getCluster()
      Return operating cluster.
    • put

      void put(WritePolicy policy, Key key, Bin... bins) throws AerospikeException
      Write record bin(s). The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if write fails
    • put

      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 transaction timeout, record expiration and how the transaction is handled when the record already exists.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if event loop registration fails
    • append

      void append(WritePolicy policy, Key key, Bin... bins) throws AerospikeException
      Append bin string values to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for string values.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if append fails
    • append

      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 transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for string values.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if event loop registration fails
    • prepend

      void prepend(WritePolicy policy, Key key, Bin... bins) throws AerospikeException
      Prepend bin string values to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call works only for string values.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if prepend fails
    • prepend

      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 transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for string values.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if event loop registration fails
    • add

      void add(WritePolicy policy, Key key, Bin... bins) throws AerospikeException
      Add integer bin values to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for integer values.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if add fails
    • add

      void add(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key, Bin... bins) throws AerospikeException
      Asynchronously add integer bin 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 transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for integer values.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      bins - array of bin name/value pairs
      Throws:
      AerospikeException - if event loop registration fails
    • delete

      boolean delete(WritePolicy policy, Key key) throws AerospikeException
      Delete record for specified key. The policy specifies the transaction timeout.
      Parameters:
      policy - delete configuration parameters, pass in null for defaults
      key - unique record identifier
      Returns:
      whether record existed on server before deletion
      Throws:
      AerospikeException - if delete fails
    • delete

      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 transaction timeout.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if event loop registration fails
    • delete

      BatchResults delete(BatchPolicy batchPolicy, BatchDeletePolicy deletePolicy, Key[] keys) throws AerospikeException
      Delete records for specified keys. If a key is not found, the corresponding result BatchRecord.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      Parameters:
      batchPolicy - batch configuration parameters, pass in null for defaults
      deletePolicy - delete configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException.BatchRecordArray - which contains results for keys that did complete
      AerospikeException
    • delete

      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.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      deletePolicy - delete configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • delete

      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.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      deletePolicy - delete configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • truncate

      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).

      Parameters:
      policy - info command configuration parameters, pass in null for defaults
      ns - required namespace
      set - 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

      void touch(WritePolicy policy, Key key) throws AerospikeException
      Reset record's time to expiration using the policy's expiration. Fail if the record does not exist.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if touch fails
    • touch

      void touch(EventLoop eventLoop, WriteListener listener, WritePolicy policy, Key key) throws AerospikeException
      Asynchronously reset record's time to expiration using the policy's expiration. 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.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if event loop registration fails
    • exists

      boolean exists(Policy policy, Key key) throws AerospikeException
      Determine if a record key exists. The policy can be used to specify timeouts.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Returns:
      whether record exists or not
      Throws:
      AerospikeException - if command fails
    • exists

      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.

      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
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if event loop registration fails
    • exists

      boolean[] exists(BatchPolicy policy, Key[] keys) throws AerospikeException
      Check if multiple record keys exist in one batch call. The returned boolean array is in positional order with the original key array order.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Returns:
      array key/existence status pairs
      Throws:
      AerospikeException.BatchExists - which contains results for keys that did complete
      AerospikeException
    • exists

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • exists

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • get

      Record get(Policy policy, Key key) throws AerospikeException
      Read entire record for specified key. The policy can be used to specify timeouts.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Returns:
      if found, return record instance. If not found, return null.
      Throws:
      AerospikeException - if read fails
    • get

      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.

      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
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if event loop registration fails
    • get

      Record get(Policy policy, Key key, String... binNames) throws AerospikeException
      Read record header and bins for specified key. The policy can be used to specify timeouts.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      binNames - bins to retrieve
      Returns:
      if found, return record instance. If not found, return null.
      Throws:
      AerospikeException - if read fails
    • get

      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.

      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
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      binNames - bins to retrieve
      Throws:
      AerospikeException - if event loop registration fails
    • getHeader

      Record getHeader(Policy policy, Key key) throws AerospikeException
      Read record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Returns:
      if found, return record instance. If not found, return null.
      Throws:
      AerospikeException - if read fails
    • getHeader

      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.

      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
      policy - generic configuration parameters, pass in null for defaults
      key - unique record identifier
      Throws:
      AerospikeException - if event loop registration fails
    • get

      boolean get(BatchPolicy policy, List<BatchRead> records) throws AerospikeException
      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.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      records - 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

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      records - 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

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      records - 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

      Record[] get(BatchPolicy policy, Key[] keys) throws AerospikeException
      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.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Returns:
      array of records
      Throws:
      AerospikeException.BatchRecords - which contains results for keys that did complete
      AerospikeException
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • get

      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.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      binNames - array of bins to retrieve
      Returns:
      array of records
      Throws:
      AerospikeException.BatchRecords - which contains results for keys that did complete
      AerospikeException
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      binNames - array of bins to retrieve
      Throws:
      AerospikeException - if event loop registration fails
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      binNames - array of bins to retrieve
      Throws:
      AerospikeException - if event loop registration fails
    • get

      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.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - array of read operations on record
      Returns:
      array of records
      Throws:
      AerospikeException.BatchRecords - which contains results for keys that did complete
      AerospikeException
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - array of read operations on record
      Throws:
      AerospikeException - if event loop registration fails
    • get

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - array of read operations on record
      Throws:
      AerospikeException - if event loop registration fails
    • getHeader

      Record[] getHeader(BatchPolicy policy, Key[] keys) throws AerospikeException
      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.
      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Returns:
      array of records
      Throws:
      AerospikeException.BatchRecords - which contains results for keys that did complete
      AerospikeException
    • getHeader

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • getHeader

      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.

      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
      policy - batch configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      Throws:
      AerospikeException - if event loop registration fails
    • operate

      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.

      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      operations - database operations to perform
      Returns:
      record if there is a read in the operations list
      Throws:
      AerospikeException - if command fails
    • operate

      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.

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      operations - database operations to perform
      Throws:
      AerospikeException - if event loop registration fails
    • operate

      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.

      BatchRecord can be BatchRead, BatchWrite, BatchDelete or BatchUDF.

      Requires server version 6.0+

      Parameters:
      policy - batch configuration parameters, pass in null for defaults
      records - list of unique record identifiers and read/write operations
      Returns:
      true if all batch sub-commands succeeded
      Throws:
      AerospikeException - if command fails
    • operate

      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.

      BatchRecord can be BatchRead, BatchWrite, BatchDelete or BatchUDF.

      Requires server version 6.0+

      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
      policy - batch configuration parameters, pass in null for defaults
      records - list of unique record identifiers and read/write operations
      Throws:
      AerospikeException - if event loop registration fails
    • operate

      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.

      BatchRecord can be BatchRead, BatchWrite, BatchDelete or BatchUDF.

      Requires server version 6.0+

      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
      policy - batch configuration parameters, pass in null for defaults
      records - list of unique record identifiers and read/write operations
      Throws:
      AerospikeException - if event loop registration fails
    • operate

      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 result BatchRecord.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      Parameters:
      batchPolicy - batch configuration parameters, pass in null for defaults
      writePolicy - write configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - database operations to perform
      Throws:
      AerospikeException.BatchRecordArray - which contains results for keys that did complete
      AerospikeException
    • operate

      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.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      writePolicy - write configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - array of read/write operations on record
      Throws:
      AerospikeException - if event loop registration fails
    • operate

      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.resultCode will be ResultCode.KEY_NOT_FOUND_ERROR.

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      writePolicy - write configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      ops - array of read operations on record
      Throws:
      AerospikeException - if event loop registration fails
    • scanAll

      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's concurrentNodes is 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.

      Parameters:
      policy - scan configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      callback - read callback method - called with record data
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if scan fails
    • scanAll

      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's concurrentNodes is 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.

      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
      policy - scan configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if event loop registration fails
    • scanNode

      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.

      Parameters:
      policy - scan configuration parameters, pass in null for defaults
      nodeName - server node name
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      callback - read callback method - called with record data
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if scan fails
    • scanNode

      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.

      Parameters:
      policy - scan configuration parameters, pass in null for defaults
      node - server node
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      callback - read callback method - called with record data
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if scan fails
    • scanPartitions

      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.

      Parameters:
      policy - scan configuration parameters, pass in null for defaults
      partitionFilter - filter on a subset of data partitions
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      callback - read callback method - called with record data
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if scan fails
    • scanPartitions

      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.

      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
      policy - scan configuration parameters, pass in null for defaults
      partitionFilter - filter on a subset of data partitions
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      binNames - optional bin to retrieve. All bins will be returned if not specified.
      Throws:
      AerospikeException - if event loop registration fails
    • register

      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.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      clientPath - path of client file containing user defined functions, relative to current directory
      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
    • register

      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.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      resourceLoader - class loader where resource is located. Example: MyClass.class.getClassLoader() or Thread.currentThread().getContextClassLoader() for webapps
      resourcePath - class path where Lua resource is located
      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
    • registerUdfString

      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.

      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      code - 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

      void removeUdf(InfoPolicy policy, String serverPath) throws AerospikeException
      Remove user defined function from server nodes.
      Parameters:
      policy - info configuration parameters, pass in null for defaults
      serverPath - location of UDF on server nodes. Example: mylua.lua
      Throws:
      AerospikeException - if remove fails
    • execute

      Object execute(WritePolicy policy, Key key, String packageName, String functionName, Value... args) 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

      Parameters:
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      packageName - server package name where user defined function resides
      functionName - user defined function
      args - arguments passed in to user defined function
      Returns:
      return value of user defined function
      Throws:
      AerospikeException - if transaction fails
    • execute

      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

      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 forget
      policy - write configuration parameters, pass in null for defaults
      key - unique record identifier
      packageName - server package name where user defined function resides
      functionName - user defined function
      functionArgs - arguments passed in to user defined function
      Throws:
      AerospikeException - if event loop registration fails
    • execute

      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>.lua

      Requires server version 6.0+

      Parameters:
      batchPolicy - batch configuration parameters, pass in null for defaults
      udfPolicy - udf configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      packageName - server package name where user defined function resides
      functionName - user defined function
      functionArgs - arguments passed in to user defined function
      Throws:
      AerospikeException.BatchRecordArray - which contains results for keys that did complete
      AerospikeException
    • execute

      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>.lua

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      udfPolicy - udf configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      packageName - server package name where user defined function resides
      functionName - user defined function
      functionArgs - arguments passed in to user defined function
      Throws:
      AerospikeException - if command fails
    • execute

      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>.lua

      Requires server version 6.0+

      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
      batchPolicy - batch configuration parameters, pass in null for defaults
      udfPolicy - udf configuration parameters, pass in null for defaults
      keys - array of unique record identifiers
      packageName - server package name where user defined function resides
      functionName - user defined function
      functionArgs - arguments passed in to user defined function
      Throws:
      AerospikeException - if command fails
    • execute

      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.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      statement - background query definition
      packageName - server package where user defined function resides
      functionName - function name
      functionArgs - to pass to function name, if any
      Throws:
      AerospikeException - if command fails
    • execute

      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.
      Parameters:
      policy - write configuration parameters, pass in null for defaults
      statement - background query definition
      operations - list of operations to be performed on selected records
      Throws:
      AerospikeException - if command fails
    • query

      RecordSet query(QueryPolicy policy, Statement statement) throws AerospikeException
      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.
      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      Returns:
      record iterator
      Throws:
      AerospikeException - if query fails
    • query

      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.

      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
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      Throws:
      AerospikeException - if event loop registration fails
    • query

      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.maxConcurrentNodes is 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.

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition.
      listener - where to send results
      Throws:
      AerospikeException - if query fails
    • query

      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.maxConcurrentNodes is 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.

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition.
      partitionFilter - data partition filter. Set to PartitionFilter.all() for all partitions.
      listener - where to send results
      Throws:
      AerospikeException - if query fails
    • queryNode

      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.
      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      node - server node to execute query
      Returns:
      record iterator
      Throws:
      AerospikeException - if query fails
    • queryPartitions

      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.

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      partitionFilter - filter on a subset of data partitions
      Throws:
      AerospikeException - if query fails
    • queryPartitions

      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.

      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
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      partitionFilter - filter on a subset of data partitions
      Throws:
      AerospikeException - if query fails
    • queryAggregate

      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

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      packageName - server package where user defined function resides
      functionName - aggregation function name
      functionArgs - arguments to pass to function name, if any
      Returns:
      result iterator
      Throws:
      AerospikeException - if query fails
    • queryAggregate

      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.

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      Throws:
      AerospikeException - if query fails
    • queryAggregateNode

      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.

      Parameters:
      policy - query configuration parameters, pass in null for defaults
      statement - query definition
      node - server node to execute query
      Throws:
      AerospikeException - if query fails
    • createIndex

      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.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      indexName - name of secondary index
      binName - bin name that data is indexed on
      indexType - underlying data type of secondary index
      Throws:
      AerospikeException - if index create fails
    • createIndex

      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.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      indexName - name of secondary index
      binName - bin name that data is indexed on
      indexType - underlying data type of secondary index
      indexCollectionType - index collection type
      ctx - optional context to index on elements within a CDT
      Throws:
      AerospikeException - if index create fails
    • createIndex

      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.
      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
      policy - generic configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      indexName - name of secondary index
      binName - bin name that data is indexed on
      indexType - underlying data type of secondary index
      indexCollectionType - index collection type
      ctx - optional context to index on elements within a CDT
      Throws:
      AerospikeException - if index create fails
    • dropIndex

      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.
      Parameters:
      policy - generic configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      indexName - name of secondary index
      Throws:
      AerospikeException - if index drop fails
    • dropIndex

      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.
      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
      policy - generic configuration parameters, pass in null for defaults
      namespace - namespace - equivalent to database name
      setName - optional set name - equivalent to database table
      indexName - name of secondary index
      Throws:
      AerospikeException - if index drop fails
    • info

      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

      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
      policy - info configuration parameters, pass in null for defaults
      node - server node to execute command, pass in null for random node
      commands - list of info commands
      Throws:
      AerospikeException - if info commands fail
    • setXDRFilter

      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.
      Parameters:
      policy - info configuration parameters, pass in null for defaults
      datacenter - XDR datacenter name
      namespace - namespace - equivalent to database name
      filter - expression filter
      Throws:
      AerospikeException - if command fails
    • createUser

      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.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name
      password - user password in clear-text format
      roles - variable arguments array of role names. Valid roles are listed in Role
      Throws:
      AerospikeException - if command fails
    • dropUser

      void dropUser(AdminPolicy policy, String user) throws AerospikeException
      Remove user from cluster.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name
      Throws:
      AerospikeException - if command fails
    • changePassword

      void changePassword(AdminPolicy policy, String user, String password) throws AerospikeException
      Change user's password.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name
      password - user password in clear-text format
      Throws:
      AerospikeException - if command fails
    • grantRoles

      void grantRoles(AdminPolicy policy, String user, List<String> roles) throws AerospikeException
      Add roles to user's list of roles.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name
      roles - role names. Valid roles are listed in Role
      Throws:
      AerospikeException - if command fails
    • revokeRoles

      void revokeRoles(AdminPolicy policy, String user, List<String> roles) throws AerospikeException
      Remove roles from user's list of roles.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name
      roles - role names. Valid roles are listed in Role
      Throws:
      AerospikeException - if command fails
    • createRole

      void createRole(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException
      Create user defined role.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      privileges - privileges assigned to the role.
      Throws:
      AerospikeException - if command fails
    • createRole

      void createRole(AdminPolicy policy, String roleName, List<Privilege> privileges, List<String> whitelist) throws AerospikeException
      Create user defined role with optional privileges and whitelist.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      privileges - 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

      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.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      privileges - 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

      void dropRole(AdminPolicy policy, String roleName) throws AerospikeException
      Drop user defined role.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      Throws:
      AerospikeException - if command fails
    • grantPrivileges

      void grantPrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException
      Grant privileges to an user defined role.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      privileges - privileges assigned to the role.
      Throws:
      AerospikeException - if command fails
    • revokePrivileges

      void revokePrivileges(AdminPolicy policy, String roleName, List<Privilege> privileges) throws AerospikeException
      Revoke privileges from an user defined role.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      privileges - privileges assigned to the role.
      Throws:
      AerospikeException - if command fails
    • setWhitelist

      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.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      whitelist - list of allowable IP addresses or null. IP addresses can contain wildcards (ie. 10.1.2.0/24).
      Throws:
      AerospikeException - if command fails
    • setQuotas

      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.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name
      readQuota - 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

      User queryUser(AdminPolicy policy, String user) throws AerospikeException
      Retrieve roles for a given user.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      user - user name filter
      Throws:
      AerospikeException - if command fails
    • queryUsers

      List<User> queryUsers(AdminPolicy policy) throws AerospikeException
      Retrieve all users and their roles.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      Throws:
      AerospikeException - if command fails
    • queryRole

      Role queryRole(AdminPolicy policy, String roleName) throws AerospikeException
      Retrieve role definition.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      roleName - role name filter
      Throws:
      AerospikeException - if command fails
    • queryRoles

      List<Role> queryRoles(AdminPolicy policy) throws AerospikeException
      Retrieve all roles.
      Parameters:
      policy - admin configuration parameters, pass in null for defaults
      Throws:
      AerospikeException - if command fails