All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
Large Data Type Operations (3.0 only)

Description

The ldt_operations module provides API to manipulate Large Data Types. Currently supported types include:

Forthcoming API:

+ Collaboration diagram for Large Data Type Operations (3.0 only):

Functions

as_status aerospike_llist_add (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val)
 
as_status aerospike_llist_add_all (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_list *vals)
 
as_status aerospike_llist_destroy (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt)
 
as_status aerospike_llist_filter (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
 
as_status aerospike_llist_find (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *search_val, as_list **elements)
 
as_status aerospike_llist_get_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *ldt_capacity)
 
as_status aerospike_llist_ldt_exists (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_boolean *ldt_exists)
 
as_status aerospike_llist_range (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *min_value, const as_val *max_value, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
 
as_status aerospike_llist_remove (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *element)
 
as_status aerospike_llist_scan (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_list **elements)
 
as_status aerospike_llist_set_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t ldt_capacity)
 
as_status aerospike_llist_size (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *n)
 
as_status aerospike_lmap_destroy (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt)
 
as_status aerospike_lmap_filter (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_udf_function_name filter, const as_list *filter_args, as_map **elements)
 
as_status aerospike_lmap_get (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *mkey, as_val **mval)
 
as_status aerospike_lmap_get_all (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_map **elements)
 
as_status aerospike_lmap_get_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *ldt_capacity)
 
as_status aerospike_lmap_ldt_exists (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_boolean *ldt_exists)
 
as_status aerospike_lmap_put (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *mkey, const as_val *mval)
 
as_status aerospike_lmap_put_all (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_map *vals)
 
as_status aerospike_lmap_remove (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *mkey)
 
as_status aerospike_lmap_set_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t ldt_capacity)
 
as_status aerospike_lmap_size (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *n)
 
as_status aerospike_lset_add (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val)
 
as_status aerospike_lset_add_all (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_list *vals)
 
as_status aerospike_lset_destroy (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt)
 
as_status aerospike_lset_exists (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val, as_boolean *exists)
 
as_status aerospike_lset_filter (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
 
as_status aerospike_lset_get (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val, as_val **pp_return_val)
 
as_status aerospike_lset_get_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *ldt_capacity)
 
as_status aerospike_lset_ldt_exists (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_boolean *ldt_exists)
 
as_status aerospike_lset_remove (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *element)
 
as_status aerospike_lset_scan (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_list **elements)
 
as_status aerospike_lset_set_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t ldt_capacity)
 
as_status aerospike_lset_size (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *n)
 
as_status aerospike_lstack_destroy (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt)
 
as_status aerospike_lstack_filter (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t peek_count, const as_udf_function_name filter, const as_list *filter_args, as_list **elements)
 
as_status aerospike_lstack_get_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *ldt_capacity)
 
as_status aerospike_lstack_ldt_exists (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, as_boolean *ldt_exists)
 
as_status aerospike_lstack_peek (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t peek_count, as_list **elements)
 
as_status aerospike_lstack_push (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_val *val)
 
as_status aerospike_lstack_push_all (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, const as_list *vals)
 
as_status aerospike_lstack_set_capacity (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t ldt_capacity)
 
as_status aerospike_lstack_size (aerospike *as, as_error *err, const as_policy_apply *policy, const as_key *key, const as_ldt *ldt, uint32_t *n)
 

Function Documentation

as_status aerospike_llist_add ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val val 
)

Functionality related to Large List Data Type Add a value into the llist.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_integer_init(&ival, 123);
if ( aerospike_llist_add(&as, &err, NULL, &key, &llist, (as_val *) &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
valThe value to insert into the llist.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_add_all ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_list vals 
)

Add a list of values into the llist.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_string_init(s,"a string",false);
if ( aerospike_llist_add_all(&as, &err, NULL, &key, &llist, (as_list *)vals) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
valsThe list of values to insert into the llist.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_destroy ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt 
)

Destroy the llist bin

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
if ( aerospike_llist_destroy(&as, &err, NULL, &key, &llist) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to destroy. If not an llist bin, will return error.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_filter ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_udf_function_name  filter,
const as_list filter_args,
as_list **  elements 
)

Given an llist bin, filter the collection of objects using the given filter function. If no filter function is specified, return all values.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_list *result_list = NULL;
if ( aerospike_llist_filter(&as, &err, NULL, &key, &llist,
"search_filter", NULL, &result_list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
as_arraylist_destroy(result_list);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to search from. If not an llist bin, will return error.
filterThe name of the User-Defined-Function to use as a search filter.
fargsThe list of parameters passed in to the User-Defined-Function filter.
listThe pointer to a list of elements returned from search function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_find ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val search_val,
as_list **  elements 
)

Search for a value in the llist.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_integer search_val;
as_integer_init(&search_val, 42);
as_list *result_list = NULL;
if ( aerospike_llist_find(&as, &err, NULL, &key, &llist, &search_val, &result_list ) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// do logic because element exists
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to lookup from. If not an llist bin, will return error.
search_valThe search value
result_listThe returned list of values
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_get_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  ldt_capacity 
)

Check the storage capacity for this LDT.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_llist_get_capacity(&as, &err, NULL, &key, &llist, &ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LLIST bin, will return error.
ldt_capacitySet by function to 1 for true, 0 for false
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_ldt_exists ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_boolean ldt_exists 
)

Check to see if an LLIST object exists in this record bin.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
uint32_t ldt_exists = 0;
if ( aerospike_llist_size(&as, &err, NULL, &key, &llist, &ldt_exists) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LLIST bin, will return error.
ldt_existsPtr to as_boolean: Set to TRUE if ldt exists, otherwise false.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_range ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val min_value,
const as_val max_value,
const as_udf_function_name  filter,
const as_list filter_args,
as_list **  elements 
)

Given an llist bin, return the key values from MIN to MAX, and then filter the returned collection of objects using the given filter function. If no filter function is specified, return all values.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_integer min_value;
as_integer_init(&min_value, 18);
as_integer max_value;
as_integer_init(&max_value, 99);
as_list *result_list = NULL;
if ( aerospike_llist_range(&as, &err, NULL, &key, &llist, &min_value, &max_value,
"search_filter", NULL, &result_list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
as_arraylist_destroy(result_list);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to search from. If not an llist bin, will return error.
min_valueThe minimum range value (or null to be LEAST value)
max_valueThe maximum range value (or null to be the GREATEST value)
filterThe name of the User-Defined-Function to use as a search filter (or null if no filter)
fargsThe list of parameters passed in to the User-Defined-Function filter (or null)
listThe pointer to a list of elements returned from search function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_remove ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val element 
)

Delete the given value from the llist

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "llist", AS_LDT_LLIST, NULL);
as_integer_init(&ival, 123);
if ( aerospike_llist_remove(&as, &err, NULL, &key, &llist, &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to delete from. If not an llist bin, will return error.
valThe value to delete from the set.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_scan ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_list **  elements 
)

Given an llist bin, return all values in the list.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
as_list *result_list = NULL;
if ( aerospike_llist_filter(&as, &err, NULL, &key, &llist,
&result_list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
as_arraylist_destroy(result_list);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist bin to search from. If not an llist bin, will return error.
listThe pointer to a list of elements returned from search function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_set_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  ldt_capacity 
)

SET the storage capacity for this LDT.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
uint32_t ldt_capacity = 5000;
if ( aerospike_llist_set_capacity(&as, &err, NULL, &key, &llist, ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LLIST bin, will return error.
ldt_capacitySet by function to 1 for true, 0 for false
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_llist_size ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  n 
)

Look up a llist and find how many elements it contains

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt llist;
as_ldt_init(&llist, "myllist", AS_LDT_LLIST, NULL);
uint32_t llist_size = 0;
if ( aerospike_llist_size(&as, &err, NULL, &key, &llist, &llist_size) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe llist to operate on. If not an llist bin, will return error.
nReturn the number of elements in the llist.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_destroy ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt 
)

Destroy the lmap bin

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
if ( aerospike_lmap_destroy(&as, &err, NULL, &key, &lmap) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap bin to destroy. If not an lmap bin, will return error.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_filter ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_udf_function_name  filter,
const as_list filter_args,
as_map **  elements 
)

Given an lmap bin, scan through all entries in the map, and apply the given filter function. If no filter function is specified, all values in the lmap will be returned.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
as_map *p_map = NULL;
if ( aerospike_lmap_filter(&as, &err, NULL, &key, &lmap,
"counter_filter", NULL, (as_map *) &p_map) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap bin to operate on. If not an lmap bin, will return error.
filterThe name of the User-Defined-Function to use as a read-filter. The UDF should either return the entry, or nil, if filtered out.
fargsThe list of parameters passed in to the User-Defined-Function filter.
elementsThe pointer to a map of entries returned from the function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_get ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val mkey,
as_val **  mval 
)

Get the value of an entry in the Lmap, using the given map-key

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
as_integer_init(&ival, 123);
boolean exists = false;
if ( aerospike_lmap_get(&as, &err, NULL, &key, &lmap, &ikey, &p_val) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// do logic because element exists
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap bin to lookup from. If not an lmap bin, will return error.
existsReturned boolean value to indicate value exists.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_get_all ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_map **  elements 
)

Get all the entries in an lmap

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
as_map *p_map = NULL;
if ( aerospike_lmap_get_all(&as, &err, NULL, &key, &lmap, &p_map) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// do logic because element exists
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap bin to lookup from. If not an lmap bin, will return error.
elementsReturned pointer to the map of entries.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_get_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  ldt_capacity 
)

Get an LDTs storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lmap_get_capacity(&as, &err, NULL, &key, &lmap, &ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT bin to operate on
ldt_capacityThe LDT Capacity, in terms of elements, not bytes.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_ldt_exists ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_boolean ldt_exists 
)

Check to see if an LDT object exists in this record bin.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
uint32_t ldt_exists = 0;
if ( aerospike_lmap_ldt_exists(&as, &err, NULL, &key, &lmap, &ldt_exists) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LMAP bin, will return error.
ldt_existsPtr to as_boolean: Set to TRUE if ldt exists, otherwise false.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_put ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val mkey,
const as_val mval 
)

Functionality related to Large Map Data Type Add a value into the lmap.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
as_integer_init(&ival, 123);
if ( aerospike_lmap_put(&as, &err, NULL, &key, &lmap, (const as_val *) &ival, (as_val *) &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
mkeyThe map-key.
valThe map-value associated with mkey.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_put_all ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_map vals 
)

Add multiple entries into the lmap.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
as_string_init(s,"a string",false);
if ( aerospike_lmap_put_all(&as, &err, NULL, &key, &lmap, (const as_map *)vals) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
valsA map containing the entries to add to the lmap.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_remove ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val mkey 
)

Delete the given value from the lmap

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "lmap", AS_LDT_LMAP, NULL);
as_integer_init(&ival, 123);
if ( aerospike_lmap_remove(&as, &err, NULL, &key, &lmap, (const as_val*)&ikey) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap bin to delete from. If not an lmap bin, will return error.
valThe value to delete from the set.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_set_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  ldt_capacity 
)

Change an LDT storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lmap_set_capacity(&as, &err, NULL, &key, &lmap, ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to check
ldt_capacityThe new capacity for this LDT, in terms of elements, not bytes
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lmap_size ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  n 
)

Look up a lmap and find how many elements it contains

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lmap;
as_ldt_init(&lmap, "mylmap", AS_LDT_LMAP, NULL);
uint32_t lmap_size = 0;
if ( aerospike_lmap_size(&as, &err, NULL, &key, &lmap, &lmap_size) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lmap to operate on. If not an lmap bin, will return error.
nReturn the number of elements in the lmap.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_add ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val val 
)

Functionality related to Large Set Data Type Add a value into the lset.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_integer_init(&ival, 123);
if ( aerospike_lset_add(&as, &err, NULL, &key, &lset, (as_val *) &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
valThe value to insert into the lset.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_add_all ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_list vals 
)

Add a list of values into the lset.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_string_init(s,"a string",false);
if ( aerospike_lset_add_all(&as, &err, NULL, &key, &lset, (as_list *)vals) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to insert values to.
valsThe list of values to insert into the lset.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_destroy ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt 
)

Destroy the lset bin

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
if ( aerospike_lset_destroy(&as, &err, NULL, &key, &lset) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to destroy. If not an lset bin, will return error.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_exists ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val val,
as_boolean exists 
)

See if a value exists in an lset

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_integer_init(&ival, 123);
boolean exists = false;
if ( aerospike_lset_exists(&as, &err, NULL, &key, &lset, &ival, &exists) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// do logic because element exists
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to lookup from. If not an lset bin, will return error.
valThe value we're searching for.
existsReturned boolean value to indicate value exists.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_filter ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_udf_function_name  filter,
const as_list filter_args,
as_list **  elements 
)

Given an lset bin, filter the set of objects using the given filter function. If no filter function is specified, all values in the set will be returned.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_list *list = NULL;
if ( aerospike_lset_filter(&as, &err, NULL, &key, &lset,
"search_filter", NULL, (as_list *) &list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to search from. If not an lset bin, will return error.
filterThe name of the User-Defined-Function to use as a search filter.
fargsThe list of parameters passed in to the User-Defined-Function filter.
listThe pointer to a list of elements returned from search function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_get ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val val,
as_val **  pp_return_val 
)

Fetch (get) a value from the lset. Note that this is useful mainly in the case where the search criteria for an object is less than the entire object – and that is when the standard defaults are overridden and the unique_identifier() function is employed to use only part of the object for search and compare. The unique_identifier() function is defined on create – and declared in the USER_MODULE.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_integer_init(&ival, 123);
as_val * p_return_val;
if ( aerospike_lset_exists(&as, &err, NULL, &key, &lset, &ival, &p_return_value) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// do logic because element exists
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to lookup from. If not an lset bin, will return error.
valThe value we're searching for.
pp_return_valReturned value.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_get_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  ldt_capacity 
)

Get an LDTs storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LMAP, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lset_get_capacity(&as, &err, NULL, &key, &lset, &ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT bin to operate on
ldt_capacityThe LDT Capacity, in terms of elements, not bytes.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_ldt_exists ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_boolean ldt_exists 
)

Check to see if an LDT object exists in this record bin.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
uint32_t ldt_exists = 0;
if ( aerospike_lset_ldt_exists(&as, &err, NULL, &key, &lset, &ldt_exists) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LMAP bin, will return error.
ldt_existsPtr to as_boolean: Set to TRUE if ldt exists, otherwise false.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_remove ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val element 
)

Delete the given value from the lset

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "lset", AS_LDT_LSET, NULL);
as_integer_init(&ival, 123);
if ( aerospike_lset_remove(&as, &err, NULL, &key, &lset, &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to delete from. If not an lset bin, will return error.
valThe value to delete from the set.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_scan ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_list **  elements 
)

Given an lset bin, scan for all the values in the set

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
as_list *list = NULL;
if ( aerospike_lset_scan(&as, &err, NULL, &key, &lset,
"search_filter", NULL, (as_list *) &list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned elements
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset bin to search from. If not an lset bin, will return error.
listThe pointer to a list of elements returned from search function. Pointer should be NULL passed in.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_set_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  ldt_capacity 
)

Change an LDT storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LMAP, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lset_set_capacity(&as, &err, NULL, &key, &lset, ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to check
ldt_capacityThe number of elements cap for the LDT.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lset_size ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  n 
)

Look up a lset and find how many elements it contains

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lset;
as_ldt_init(&lset, "mylset", AS_LDT_LSET, NULL);
uint32_t lset_size = 0;
if ( aerospike_lset_size(&as, &err, NULL, &key, &lset, &lset_size) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe lset to operate on. If not an lset bin, will return error.
nReturn the number of elements in the lset.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_destroy ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt 
)

Destroys an existing lstack

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t cap_elements = 0;
if ( aerospike_lstack_destroy(&as, &err, NULL, &key, &stack) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_filter ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  peek_count,
const as_udf_function_name  filter,
const as_list filter_args,
as_list **  elements 
)

Look up a record by key, then peek into a stack bin, and do UDF post processing to filter for only the desired values.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t peek_count = 3;
as_arraylist list = as_arraylist_init(&list, peek_count, 0);
if ( aerospike_lstack_peek_with_filter(&as, &err, NULL, &key, &stack, peek_count,
"myfilter", NULL, (as_list *) &list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned stack elements
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
nThe number of elements to peek from the lstack.
filterThe name of the User-Defined-Function to use as a stack element filter.
fargsThe list of parameters to the User-Defined-Function filter.
listPointer to list of elements peeked from the lstack. Pointer should be initialized to NULL when passed in;
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_get_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  ldt_capacity 
)

Get an lstack's storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lstack_get_capacity(&as, &err, NULL, &key, &stack, &ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
ldt_capacityThe LDT Capacity, in terms of elements, not bytes.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_ldt_exists ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
as_boolean ldt_exists 
)

Check to see if an LSTACK object exists in this record bin.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt lstack;
as_ldt_init(&lstack, "mylstack", AS_LDT_LSTACK, NULL);
uint32_t ldt_exists = 0;
if ( aerospike_lstack_size(&as, &err, NULL, &key, &lstack, &ldt_exists) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe LDT to operate on. If not an LSTACK bin, will return error.
ldt_existsPtr to as_boolean: Set to TRUE if ldt exists, otherwise false.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_peek ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  peek_count,
as_list **  elements 
)

Look up an lstack, then peek to get the top n values from the stack.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t peek_count = 3;
as_arraylist list = as_arraylist_init(&list, peek_count, 0);
if ( aerospike_lstack_peek(&as, &err, NULL, &key, &stack, peek_count, (as_list *) &list) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
else {
// process the returned stack elements
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
nThe number of elements to peek from the lstack.
listPointer to a list of elements peeked from the lstack. Pointer should be NULL passed in. If stack_size shorter than n, only stack_size is returned.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_push ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_val val 
)

Push a value onto the lstack.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
as_integer_init(&ival, 123);
if ( aerospike_lstack_push(&as, &err, NULL, &key, &stack, (as_val *) &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to push values to.
valThe value to push on to the lstack.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_push_all ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
const as_list vals 
)

Push a value onto the lstack.

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
as_string_init(s,"a string",false);
if ( aerospike_lstack_push_all(&as, &err, NULL, &key, &stack, (as_val *) &ival) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe ldt bin to push values to.
valsThe list of values to push on to the lstack. list[0] is the first to push on the stack. list[n] is top of the stack.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_set_capacity ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t  ldt_capacity 
)

Change an LDT storage capacity (in number of elements)

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t ldt_capacity = 0;
if ( aerospike_lstack_set_capacity(&as, &err, NULL, &key, &stack, ldt_capacity) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
ldt_capacityThe number of elements cap for the lstack.
Returns
AEROSPIKE_OK if successful. Otherwise an error.
as_status aerospike_lstack_size ( aerospike as,
as_error err,
const as_policy_apply policy,
const as_key key,
const as_ldt ldt,
uint32_t *  n 
)

Find how many elements are on the lstack

as_key key;
as_key_init(&key, "myns", "myset", "mykey");
as_ldt stack;
as_ldt_init(&stack, "mystack", AS_LDT_LSTACK, NULL);
uint32_t stack_size = 0;
if ( aerospike_lstack_size(&as, &err, NULL, &key, &stack, &stack_size) != AEROSPIKE_OK ) {
fprintf(stderr, "error(%d) %s at [%s:%d]", err.code, err.message, err.file, err.line);
}
Parameters
asThe aerospike instance to use for this operation.
errThe as_error to be populated if an error occurs.
policyThe policy to use for this operation. If NULL, then the default policy will be used.
keyThe key of the record.
ldtThe stack bin to peek values from. If not a stack bin, will return error.
nReturn the number of elements on the lstack.
Returns
AEROSPIKE_OK if successful. Otherwise an error.