The Batch API is a collection of APIs that use multiple keys for looking up records in one call.
Data Structures | |
struct | as_batch_apply_record |
struct | as_batch_base_record |
struct | as_batch_read_record |
union | as_batch_record |
struct | as_batch_records |
struct | as_batch_remove_record |
struct | as_batch_write_record |
Typedefs | |
typedef as_batch_listener | aerospike_batch_read_callback |
typedef void(* | as_async_batch_listener )(as_error *err, as_batch_records *records, void *udata, as_event_loop *event_loop) |
typedef bool(* | as_batch_listener )(const as_batch_result *results, uint32_t n, void *udata) |
typedef as_batch_records | as_batch_read_records |
typedef uint8_t | as_batch_type |
This listener will be called with the results of batch commands for all keys.
Definition at line 290 of file aerospike_batch.h.
typedef void(* as_async_batch_listener)(as_error *err, as_batch_records *records, void *udata, as_event_loop *event_loop) |
Asynchronous batch user listener. This function is called once when the batch completes or an error has occurred.
err | Error structure that is populated if an error occurs. NULL on success. |
records | Record results. Records must be destroyed with as_batch_records_destroy() when done. |
udata | User data that is forwarded from asynchronous command function. |
event_loop | Event loop that this command was executed on. Use this event loop when running nested asynchronous commands when single threaded behavior is desired for the group of commands. |
Definition at line 305 of file aerospike_batch.h.
typedef bool(* as_batch_listener)(const as_batch_result *results, uint32_t n, void *udata) |
This listener will be called with the results of batch commands for all keys.
The results
argument will be an array of n
as_batch_result entries. The results
argument is on the stack and is only available within the context of the listener. To use the data outside of the listener, copy the data.
results | The results from the batch request. |
n | The number of results from the batch request. |
udata | User-data provided to the calling function. |
true
on success. Otherwise, an error occurred. Definition at line 282 of file aerospike_batch.h.
List of batch request/response (as_batch_base_record) records. The record types can be as_batch_read_record, as_batch_write_record, as_batch_apply_record or as_batch_remove_record.
Definition at line 261 of file aerospike_batch.h.
typedef uint8_t as_batch_type |
Batch record type. Values: AS_BATCH_READ, AS_BATCH_WRITE, AS_BATCH_APPLY or AS_BATCH_REMOVE
Definition at line 58 of file aerospike_batch.h.
AS_EXTERN as_status aerospike_batch_apply | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_policy_batch_apply * | policy_apply, | ||
const as_batch * | batch, | ||
const char * | module, | ||
const char * | function, | ||
as_list * | arglist, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Apply UDF (user defined function) on multiple keys. Requires server version 6.0+
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
policy_apply | UDF policy configuration parameters, pass in NULL for default. |
batch | List of keys. |
module | Server package name. |
function | Server user defined function. |
arglist | Server user defined function arguments. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_exists | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_batch * | batch, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Test whether multiple records exist in the cluster.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
batch | The batch of keys to read. |
listener | The listener to invoke for each record read. |
udata | The user-data for the listener. |
AS_EXTERN as_status aerospike_batch_get | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_batch * | batch, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Look up multiple records by key, then return all bins.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
batch | List of keys. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_get_bins | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_batch * | batch, | ||
const char ** | bins, | ||
uint32_t | n_bins, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Look up multiple records by key, then return specified bins.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
batch | The batch of keys to read. |
bins | Bin filters. Only return these bins. |
n_bins | The number of bin filters. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_get_ops | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_batch * | batch, | ||
as_operations * | ops, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Look up multiple records by key, then return results from specified read operations.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
batch | The batch of keys to read. |
ops | Read operations. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_operate | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_policy_batch_write * | policy_write, | ||
const as_batch * | batch, | ||
as_operations * | ops, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Perform read/write operations on multiple keys. Requires server version 6.0+
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
policy_write | Write policy configuration parameters, pass in NULL for default. |
batch | List of keys. |
ops | Read/Write operations. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_read | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
as_batch_records * | records | ||
) |
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 batch array.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
records | List of keys and records to retrieve. The returned records are located in the same array. |
AS_EXTERN as_status aerospike_batch_read_async | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
as_batch_records * | records, | ||
as_async_batch_listener | listener, | ||
void * | udata, | ||
as_event_loop * | event_loop | ||
) |
Asynchronously 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 batch array.
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
records | List of keys and records to retrieve. Returned records are located in the same list. Must create using as_batch_records_create() (allocates memory on heap) because the async method returns immediately after queueing command. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
event_loop | Event loop assigned to run this command. If NULL, an event loop will be chosen by round-robin. |
AS_EXTERN as_status aerospike_batch_remove | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
const as_policy_batch_remove * | policy_remove, | ||
const as_batch * | batch, | ||
as_batch_listener | listener, | ||
void * | udata | ||
) |
Remove multiple records. Requires server version 6.0+
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
policy_remove | Remove policy configuration parameters, pass in NULL for default. |
batch | List of keys. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
AS_EXTERN as_status aerospike_batch_write | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
as_batch_records * | records | ||
) |
Read/Write multiple records for specified batch keys in one batch call. This method allows different sub-commands for each key in the batch. The returned records are located in the same list.
Requires server version 6.0+
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
records | List of batch sub-commands to perform. The returned records are located in the same list. |
AS_EXTERN as_status aerospike_batch_write_async | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_batch * | policy, | ||
as_batch_records * | records, | ||
as_async_batch_listener | listener, | ||
void * | udata, | ||
as_event_loop * | event_loop | ||
) |
Asynchronously read/write multiple records for specified batch keys in one batch call. This method allows different sub-commands for each key in the batch. The returned records are located in the same list.
Requires server version 6.0+
as | Aerospike cluster instance. |
err | Error detail structure that is populated if an error occurs. |
policy | Batch policy configuration parameters, pass in NULL for default. |
records | List of keys and records to retrieve. Returned records are located in the same list. Must create using as_batch_records_create() (allocates memory on heap) because the async method returns immediately after queueing command. |
listener | User function to be called with command results. |
udata | User data to be forwarded to listener. |
event_loop | Event loop assigned to run this command. If NULL, an event loop will be chosen by round-robin. |
|
related |
Reserve a new as_batch_apply_record
slot for UDF. Capacity will be increased when necessary. Return reference to record. The record is initialized to zeroes.
Definition at line 438 of file aerospike_batch.h.
References AS_BATCH_APPLY, as_vector_reserve(), as_batch_apply_record::has_write, as_batch_records::list, and as_batch_apply_record::type.
|
related |
Create batch records on heap with specified list capacity on the heap.
Definition at line 394 of file aerospike_batch.h.
References as_vector_create().
|
related |
Destroy keys and records in record list. It's the responsility of the caller to free additional user specified fields in the record.
Definition at line 481 of file aerospike_batch.h.
References as_batch_records::as_batch_records_destroy().
|
related |
Initialize batch records with specified capacity on the heap.
Definition at line 363 of file aerospike_batch.h.
References as_vector_init(), and as_batch_records::list.
|
related |
Reserve a new as_batch_read_record
slot. Capacity will be increased when necessary. Return reference to record. The record is initialized to zeroes.
Definition at line 407 of file aerospike_batch.h.
References AS_BATCH_READ, as_vector_reserve(), as_batch_records::list, and as_batch_read_record::type.
|
related |
Create batch records on heap with specified list capacity on the heap.
When the batch is no longer needed, then use as_batch_records_destroy() to release the batch and associated resources.
capacity | Initial capacity of batch record list. List will resize when necessary. |
Definition at line 381 of file aerospike_batch.h.
References as_vector_create().
|
related |
Destroy keys and records in record list. It's the responsility of the caller to free additional user specified fields in the record.
|
related |
Initialize batch records with specified capacity on the heap.
When the batch is no longer needed, then use as_batch_records_destroy() to release the batch and associated resources.
records | Batch record list. |
capacity | Initial capacity of batch record list. List will resize when necessary. |
Definition at line 350 of file aerospike_batch.h.
References as_vector_init(), and as_batch_records::list.
|
related |
Reserve a new as_batch_remove_record
slot. Capacity will be increased when necessary. Return reference to record. The record is initialized to zeroes.
Definition at line 454 of file aerospike_batch.h.
References AS_BATCH_REMOVE, as_vector_reserve(), as_batch_remove_record::has_write, as_batch_records::list, and as_batch_remove_record::type.
|
related |
Reserve a new as_batch_write_record
slot. Capacity will be increased when necessary. Return reference to record. The record is initialized to zeroes.
Definition at line 422 of file aerospike_batch.h.
References AS_BATCH_WRITE, as_vector_reserve(), as_batch_write_record::has_write, as_batch_records::list, and as_batch_write_record::type.