Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
Batch Operations

Description

The Batch API is a collection of APIs that use multiple keys for looking up records in one call.

+ Collaboration diagram for Batch Operations:

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
 

Functions

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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
AS_EXTERN as_status aerospike_batch_read (aerospike *as, as_error *err, const as_policy_batch *policy, as_batch_records *records)
 
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)
 
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)
 
AS_EXTERN as_status aerospike_batch_write (aerospike *as, as_error *err, const as_policy_batch *policy, as_batch_records *records)
 
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)
 
static as_batch_apply_recordas_batch_apply_reserve (as_batch_records *records)
 
AS_EXTERN void as_batch_destroy (as_batch *batch)
 
AS_EXTERN as_batchas_batch_init (as_batch *batch, uint32_t size)
 
static as_keyas_batch_keyat (const as_batch *batch, uint32_t i)
 
AS_EXTERN as_batchas_batch_new (uint32_t size)
 
static as_batch_recordsas_batch_read_create (uint32_t capacity)
 
static void as_batch_read_destroy (as_batch_records *records)
 
static void as_batch_read_init (as_batch_records *records, uint32_t capacity)
 
static as_batch_read_recordas_batch_read_reserve (as_batch_records *records)
 
static as_batch_recordsas_batch_records_create (uint32_t capacity)
 
AS_EXTERN void as_batch_records_destroy (as_batch_records *records)
 
static void as_batch_records_init (as_batch_records *records, uint32_t capacity)
 
static as_batch_remove_recordas_batch_remove_reserve (as_batch_records *records)
 
static as_batch_write_recordas_batch_write_reserve (as_batch_records *records)
 

Typedef Documentation

◆ aerospike_batch_read_callback

This listener will be called with the results of batch commands for all keys.

Deprecated
Use as_batch_listener instead.

Definition at line 290 of file aerospike_batch.h.

◆ as_async_batch_listener

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.

Parameters
errError structure that is populated if an error occurs. NULL on success.
recordsRecord results. Records must be destroyed with as_batch_records_destroy() when done.
udataUser data that is forwarded from asynchronous command function.
event_loopEvent 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.

◆ as_batch_listener

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.

bool my_listener(const as_batch_result* results, uint32_t n, void* udata) {
return true;
}
Parameters
resultsThe results from the batch request.
nThe number of results from the batch request.
udataUser-data provided to the calling function.
Returns
true on success. Otherwise, an error occurred.

Definition at line 282 of file aerospike_batch.h.

◆ as_batch_read_records

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.

Deprecated
Use as_batch_records instead.

Definition at line 261 of file aerospike_batch.h.

◆ as_batch_type

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.

Function Documentation

◆ aerospike_batch_apply()

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_arraylist_init(&args, 2, 0);
as_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_status status = aerospike_batch_apply(as, &err, NULL, NULL, &batch, "mod", "func",
(as_list*)&args, NULL, NULL);
// process results
as_operations_destroy(&ops);
as_batch_destroy(&batch);
AS_EXTERN int as_arraylist_append_str(as_arraylist *list, const char *value)
AS_EXTERN as_arraylist * as_arraylist_init(as_arraylist *list, uint32_t capacity, uint32_t block_size)
AS_EXTERN void as_arraylist_destroy(as_arraylist *list)
as_status
Definition as_status.h:30
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
policy_applyUDF policy configuration parameters, pass in NULL for default.
batchList of keys.
moduleServer package name.
functionServer user defined function.
arglistServer user defined function arguments.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_exists()

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_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_status status = aerospike_batch_exists(as, &err, NULL, &batch, listener, NULL);
// process results
as_batch_destroy(&batch);
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
batchThe batch of keys to read.
listenerThe listener to invoke for each record read.
udataThe user-data for the listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_get()

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_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_status status = aerospike_batch_get(as, &err, NULL, &batch, listener, NULL);
// process results
as_batch_destroy(&batch);
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
batchList of keys.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_get_bins()

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_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
const char* bin_filters[] = {"bin1", "bin2"};
as_status status = aerospike_batch_get_bins(as, &err, NULL, &batch, bin_filters, 2, listener, NULL);
// process results
as_batch_destroy(&batch);
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
batchThe batch of keys to read.
binsBin filters. Only return these bins.
n_binsThe number of bin filters.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_get_ops()

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_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_operations_inita(&ops, 1);
as_operations_list_size(&ops, "list", NULL);
as_status status = aerospike_batch_get_ops(as, &err, NULL, &batch, &ops, listener, NULL);
// process results
as_batch_destroy(&batch);
as_operations_destroy(&ops);
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)
AS_EXTERN bool as_operations_list_size(as_operations *ops, const char *name, as_cdt_ctx *ctx)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
batchThe batch of keys to read.
opsRead operations.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_operate()

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_integer_init(&val, 100);
as_operations_inita(&ops, 3);
as_operations_list_append(&ops, bin, NULL, NULL, (as_val*)&val);
as_operations_list_size(&ops, bin, NULL);
as_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_status status = aerospike_batch_operate(as, &err, NULL, NULL, &batch, &ops, listener, NULL);
// process results
as_operations_destroy(&ops);
as_batch_destroy(&batch);
AS_EXTERN as_integer * as_integer_init(as_integer *integer, int64_t value)
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)
AS_EXTERN bool as_operations_list_append(as_operations *ops, const char *name, as_cdt_ctx *ctx, as_list_policy *policy, as_val *val)
AS_EXTERN bool as_operations_list_get_by_index(as_operations *ops, const char *name, as_cdt_ctx *ctx, int64_t index, as_list_return_type return_type)
@ AS_LIST_RETURN_VALUE
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
policy_writeWrite policy configuration parameters, pass in NULL for default.
batchList of keys.
opsRead/Write operations.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_read()

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_batch_records_inita(&records, 10);
char* bin_names[] = {"bin1", "bin2"};
char* ns = "ns";
char* set = "set";
as_batch_read_record* record = as_batch_read_reserve(&records);
as_key_init(&record->key, ns, set, "key1");
record->bin_names = bin_names;
record->n_bin_names = 2;
record = as_batch_read_reserve(&records);
as_key_init(&record->key, ns, set, "key2");
record->read_all_bins = true;
as_status status = aerospike_batch_read(as, &err, NULL, &records);
// process results
as_batch_records_destroy(&records);
AS_EXTERN as_status aerospike_batch_read(aerospike *as, as_error *err, const as_policy_batch *policy, as_batch_records *records)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
recordsList of keys and records to retrieve. The returned records are located in the same array.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_read_async()

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.

void my_listener(as_error* err, as_batch_records* records, void* udata, as_event_loop* loop)
{
if (err) {
fprintf(stderr, "Command failed: %d %s\n", err->code, err->message);
}
else {
as_vector* list = &records->list;
for (uint32_t i = 0; i < list->size; i++) {
as_batch_read_record* record = as_vector_get(list, i);
// Process record
}
}
// Must free batch records on both success and error conditions because it was created
// before calling aerospike_batch_read_async().
as_batch_records_destroy(records);
}
as_batch_records* records = as_batch_records_create(10);
// bin_names must point to a static/global array of literal/global strings.
char* bin_names[] = {"bin1", "bin2"};
char* ns = "ns";
char* set = "set";
as_batch_read_record* record = as_batch_read_reserve(records);
as_key_init(&record->key, ns, set, "key1");
record->bin_names = bin_names;
record->n_bin_names = 2;
record = as_batch_read_reserve(records);
as_key_init(&record->key, ns, set, "key2");
record->read_all_bins = true;
as_status status = aerospike_batch_read_async(as, &err, NULL, records, NULL, my_listener, NULL);
if (status != AEROSPIKE_OK) {
// Must free batch records on queue error because the listener will not be called.
as_batch_records_destroy(records);
}
@ AEROSPIKE_OK
Definition as_status.h:128
static void * as_vector_get(as_vector *vector, uint32_t index)
Definition as_vector.h:112
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)
char message[AS_ERROR_MESSAGE_MAX_SIZE]
Definition as_error.h:103
as_status code
Definition as_error.h:98
uint32_t size
Definition as_vector.h:48
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
recordsList 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.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
event_loopEvent loop assigned to run this command. If NULL, an event loop will be chosen by round-robin.
Returns
AEROSPIKE_OK if async command succesfully queued. Otherwise an error.

◆ aerospike_batch_remove()

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_batch batch;
as_batch_inita(&batch, 3);
as_key_init(as_batch_keyat(&batch,0), "ns", "set", "key1");
as_key_init(as_batch_keyat(&batch,1), "ns", "set", "key2");
as_key_init(as_batch_keyat(&batch,2), "ns", "set", "key3");
as_status status = aerospike_batch_remove(as, &err, NULL, NULL, &batch, listener, NULL);
// process results
as_batch_destroy(&batch);
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
policy_removeRemove policy configuration parameters, pass in NULL for default.
batchList of keys.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_write()

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_operations_inita(&ops1, 1);
as_operations_add_write_int64(&ops1, "bin1", 100);
as_operations_inita(&ops2, 1);
as_operations_add_write_int64(&ops2, "bin2", 200);
as_batch_records_inita(&recs, 2);
as_batch_write_record* r = as_batch_write_reserve(&recs);
as_key_init_int64(&r->key, "test", "set", 1);
r->ops = &ops1;
r = as_batch_write_reserve(&recs);
as_key_init_int64(&r->key, "test", "set", 2);
r->ops = &ops2;
as_status status = aerospike_batch_write(as, err, NULL, &recs);
// Process results. Overall status contains first error, if any.
as_operations_destroy(&ops1);
as_operations_destroy(&ops2);
as_batch_records_destroy(&recs);
AS_EXTERN as_status aerospike_batch_write(aerospike *as, as_error *err, const as_policy_batch *policy, as_batch_records *records)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
recordsList of batch sub-commands to perform. The returned records are located in the same list.
Returns
AEROSPIKE_OK if successful. Otherwise an error.

◆ aerospike_batch_write_async()

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+

void my_listener(as_error* err, as_batch_records* records, void* udata, as_event_loop* loop)
{
if (err) {
fprintf(stderr, "Command failed: %d %s\n", err->code, err->message);
}
else {
as_vector* list = &records->list;
for (uint32_t i = 0; i < list->size; i++) {
// Process record
}
}
// Must free batch records on both success and error conditions because it was created
// before calling aerospike_batch_read_async().
as_batch_records_destroy(records);
}
as_operations_inita(&ops1, 2);
as_operations_add_write_int64(&ops1, bin1, 100);
as_operations_add_read(&ops1, bin2);
as_operations_inita(&ops2, 2);
as_operations_add_write_int64(&ops1, bin3, 0);
as_operations_add_read(&ops2, bin4);
as_batch_records* recs = as_batch_records_create(2);
as_batch_write_record* wr = as_batch_write_reserve(recs);
as_key_init_int64(&wr->key, NAMESPACE, SET, 1);
wr->ops = &ops1;
wr = as_batch_write_reserve(recs);
as_key_init_int64(&wr->key, NAMESPACE, SET, 6);
wr->ops = &ops2;
as_status status = aerospike_batch_write_async(as, &err, NULL, recs, my_listener, NULL, NULL);
as_operations_destroy(&ops1);
as_operations_destroy(&ops2);
if (status != AEROSPIKE_OK) {
// Must free batch records on queue error because the listener will not be called.
as_batch_records_destroy(records);
}
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)
Parameters
asAerospike cluster instance.
errError detail structure that is populated if an error occurs.
policyBatch policy configuration parameters, pass in NULL for default.
recordsList 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.
listenerUser function to be called with command results.
udataUser data to be forwarded to listener.
event_loopEvent loop assigned to run this command. If NULL, an event loop will be chosen by round-robin.
Returns
AEROSPIKE_OK if async command succesfully queued. Otherwise an error.

◆ as_batch_apply_reserve()

static as_batch_apply_record * as_batch_apply_reserve ( as_batch_records * records)
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.

◆ as_batch_destroy()

AS_EXTERN void as_batch_destroy ( as_batch * batch)
related

Destroy the batch of keys.

AS_EXTERN void as_batch_destroy(as_batch *batch)
Parameters
batchThe batch to release.

◆ as_batch_init()

AS_EXTERN as_batch * as_batch_init ( as_batch * batch,
uint32_t size )
related

Initialize a stack allocated as_batch capable of storing capacity keys.

as_batch batch;
as_batch_init(&batch, 2);
as_key_init(as_batch_get(&batch, 0), "ns", "set", "key1");
as_key_init(as_batch_get(&batch, 1), "ns", "set", "key2");
AS_EXTERN as_batch * as_batch_init(as_batch *batch, uint32_t size)

When the batch is no longer needed, then use as_batch_destroy() to release the batch and associated resources.

Parameters
batchThe batch to initialize.
sizeThe number of keys to allocate.

◆ as_batch_keyat()

static as_key * as_batch_keyat ( const as_batch * batch,
uint32_t i )
related

Get the key at given position of the batch. If the position is not within the allocated capacity for the batchm then NULL is returned.

Parameters
batchThe batch to get the key from.
iThe position of the key.
Returns
On success, the key at specified position. If position is invalid, then NULL.

Definition at line 212 of file as_batch.h.

References as_batch::entries, as_batch::keys, and as_batch::size.

◆ as_batch_new()

AS_EXTERN as_batch * as_batch_new ( uint32_t size)
related

Create and initialize a heap allocated as_batch capable of storing capacity keys.

as_batch* batch = as_batch_new(2);
as_key_init(as_batch_get(batch, 0), "ns", "set", "key1");
as_key_init(as_batch_get(batch, 1), "ns", "set", "key2");
AS_EXTERN as_batch * as_batch_new(uint32_t size)

When the batch is no longer needed, then use as_batch_destroy() to release the batch and associated resources.

Parameters
sizeThe number of keys to allocate.

◆ as_batch_read_create()

static as_batch_records * as_batch_read_create ( uint32_t capacity)
related

Create batch records on heap with specified list capacity on the heap.

Deprecated
Use as_batch_records_create() instead.

Definition at line 394 of file aerospike_batch.h.

References as_vector_create().

◆ as_batch_read_destroy()

static void as_batch_read_destroy ( as_batch_records * records)
related

Destroy keys and records in record list. It's the responsility of the caller to free additional user specified fields in the record.

Deprecated
Use as_batch_records_destroy() instead.

Definition at line 481 of file aerospike_batch.h.

◆ as_batch_read_init()

static void as_batch_read_init ( as_batch_records * records,
uint32_t capacity )
related

Initialize batch records with specified capacity on the heap.

Deprecated
Use as_batch_records_init() instead.

Definition at line 363 of file aerospike_batch.h.

References as_vector_init(), and as_batch_records::list.

◆ as_batch_read_reserve()

static as_batch_read_record * as_batch_read_reserve ( as_batch_records * records)
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.

◆ as_batch_records_create()

static as_batch_records * as_batch_records_create ( uint32_t capacity)
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.

Parameters
capacityInitial capacity of batch record list. List will resize when necessary.
Returns
Batch record list.

Definition at line 381 of file aerospike_batch.h.

References as_vector_create().

◆ as_batch_records_destroy()

AS_EXTERN void as_batch_records_destroy ( as_batch_records * records)
related

Destroy keys and records in record list. It's the responsility of the caller to free additional user specified fields in the record.

◆ as_batch_records_init()

static void as_batch_records_init ( as_batch_records * records,
uint32_t capacity )
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.

Parameters
recordsBatch record list.
capacityInitial 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.

◆ as_batch_remove_reserve()

static as_batch_remove_record * as_batch_remove_reserve ( as_batch_records * records)
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.

◆ as_batch_write_reserve()

static as_batch_write_record * as_batch_write_reserve ( as_batch_records * records)
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.