AerospikeClient Methods

Aerospike

The AerospikeClient type exposes the following members.

Methods

  NameDescription
Public methodAdd
Add integer/double 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.
Public methodAppend
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.
Public methodChangePassword
Change user's password.
Public methodClose
Close all client connections to database server nodes.
Public methodCreateIndex(Policy, String, String, String, String, IndexType)
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.
Public methodCreateIndex(Policy, String, String, String, String, IndexType, IndexCollectionType)
Create complex secondary index 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.
Public methodCreateRole(AdminPolicy, String, IListPrivilege)
Create user defined role.
Public methodCreateRole(AdminPolicy, String, IListPrivilege, IListString)
Create user defined role with optional privileges and whitelist.
Public methodCreateRole(AdminPolicy, String, IListPrivilege, IListString, Int32, Int32)
Create user defined role with optional privileges, whitelist and read/write quotas. Quotas require server security configuration "enable-quotas" to be set to true.
Public methodCreateUser
Create user with password and roles. Clear-text password will be hashed using bcrypt before sending to server.
Public methodDelete(WritePolicy, Key)
Delete record for specified key. Return whether record existed on server before deletion. The policy specifies the transaction timeout.
Public methodDelete(BatchPolicy, BatchDeletePolicy, Key)
Delete records for specified keys. If a key is not found, the corresponding result resultCode will be KEY_NOT_FOUND_ERROR.

Requires server version 6.0+

Public methodDispose
Close all client connections to database server nodes.
Public methodDropIndex
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.
Public methodDropRole
Drop user defined role.
Public methodDropUser
Remove user from cluster.
Public methodExecute(WritePolicy, Statement, Operation)
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.
Public methodExecute(WritePolicy, Key, String, String, Value)
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

Public methodExecute(WritePolicy, Statement, String, String, Value)
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.
Public methodExecute(BatchPolicy, BatchUDFPolicy, Key, String, String, Value)
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+

Public methodExists(BatchPolicy, Key)
Check if multiple record keys exist in one batch call. The returned boolean array is in positional order with the original key array order.
Public methodExists(Policy, Key)
Determine if a record key exists. Return whether record exists or not. The policy can be used to specify timeouts.
Public methodGet(BatchPolicy, Key)
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.
Public methodGet(BatchPolicy, ListBatchRead)
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.
Public methodGet(Policy, Key)
Read entire record for specified key. If found, return record instance. If not found, return null. The policy can be used to specify timeouts.
Public methodGet(BatchPolicy, Key, Operation)
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.
Public methodGet(BatchPolicy, Key, String)
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.
Public methodGet(Policy, Key, String)
Read record header and bins for specified key. If found, return record instance. If not found, return null. The policy can be used to specify timeouts.
Public methodGetClusterStats
Return operating cluster statistics.
Public methodGetHeader(BatchPolicy, Key)
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.
Public methodGetHeader(Policy, Key)
Read record generation and expiration only for specified key. Bins are not read. If found, return record instance. If not found, return null. The policy can be used to specify timeouts.
Public methodGrantPrivileges
Grant privileges to an user defined role.
Public methodGrantRoles
Add roles to user's list of roles.
Public methodJoin(BatchPolicy, Key, Join)
Read all bins in left record and then join with right records. Each join bin name (Join.binNameKeys) must exist in the left record. The join bin must contain a list of keys. Those key are used to retrieve other records using a separate batch get.
Public methodJoin(BatchPolicy, Key, String, Join)
Read specified bins in left record and then join with right records. Each join bin name (Join.leftKeysBinName) must exist in the left record. The join bin must contain a list of keys. Those key are used to retrieve other records using a separate batch get.
Public methodOperate(BatchPolicy, ListBatchRecord)
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+

Public methodOperate(WritePolicy, Key, Operation)
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.

Public methodOperate(BatchPolicy, BatchWritePolicy, Key, Operation)
Perform read/write operations on multiple keys. If a key is not found, the corresponding result resultCode will be KEY_NOT_FOUND_ERROR.

Requires server version 6.0+

Public methodPrepend
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.
Public methodPut
Write record bin(s). The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists.
Public methodQuery(QueryPolicy, Statement)
Execute query 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.
Public methodQuery(QueryPolicy, Statement, QueryListener)
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 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.

Public methodQuery(QueryPolicy, Statement, ActionKey, Record)
Execute query and call action for each record returned from server.
Public methodQuery(QueryPolicy, Statement, PartitionFilter, QueryListener)
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 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.

Public methodQueryAggregate(QueryPolicy, Statement)
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 Lua resource file located in an assembly.

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.

Public methodQueryAggregate(QueryPolicy, Statement, ActionObject)
Execute query, apply statement's aggregation function, call action for each aggregation object returned from server.
Public methodQueryAggregate(QueryPolicy, Statement, String, String, Value)
Execute query, apply statement's aggregation function, and return result iterator. The aggregation function should be located in a Lua script file that can be found from the "LuaConfig.PackagePath" paths static variable. The default package path is "udf/?.lua" where "?" is the packageName.

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.

Public methodQueryPartitions
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.

Public methodQueryRole
Retrieve role definition.
Public methodQueryRoles
Retrieve all roles.
Public methodQueryUser
Retrieve roles for a given user.
Public methodQueryUsers
Retrieve all users and their roles.
Public methodRegister(Policy, String, String, Language)
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.
Public methodRegister(Policy, Assembly, String, String, Language)
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.
Public methodRegisterUdfString
Register UDF functions located in a code string with server. Example:
 String code = @"
 local function reducer(val1,val2)
      return val1 + val2
 end

 function sum_single_bin(stream,name)
   local function mapper(rec)
     return rec[name]
   end
   return stream : map(mapper) : reduce(reducer)
 end
";

    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.

Public methodRemoveUdf
Remove user defined function from server nodes.
Public methodRevokePrivileges
Revoke privileges from an user defined role.
Public methodRevokeRoles
Remove roles from user's list of roles.
Public methodScanAll
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.

Public methodScanNode(ScanPolicy, Node, String, String, ScanCallback, String)
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.

Public methodScanNode(ScanPolicy, String, String, String, ScanCallback, String)
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.

Public methodScanPartitions
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.

Public methodSetQuotas
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.
Public methodSetWhitelist
Set IP address whitelist for a role. If whitelist is null or empty, remove existing whitelist from role.
Public methodSetXDRFilter
Set XDR filter for given datacenter name and namespace. The expression filter indicates which records XDR should ship to the datacenter.
Public methodTouch
Reset record's time to expiration using the policy's expiration. Fail if the record does not exist.
Public methodTruncate
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 returns because new records will have last update times greater than the truncate cutoff (set at the time of truncate call).

Top
See Also

Reference