All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Fields | Private Attributes | Related Functions
as_operations Struct Reference

Detailed Description

The aerospike_key_operate() function provides the ability to execute multiple operations on a record in the database as a single atomic transaction.

The as_operations object is used to define the operations to be performed on the record.

Initialization

Before using as_operations, you must first initialize it via either:

as_operations_inita() is a macro that initializes a stack allocated as_operations and allocates an internal array of operations. The macro accepts a pointer to the stack allocated as_operations and the number of operations to be added.

as_operations_init() is a function that initializes a stack allocated as_operations. It differes from as_operations_inita() in that it allocates the internal array of operations on the heap. It accepts a pointer to the stack allocated as_operations and the number of operations to be added.

as_operations_new() is a function that will allocate a new as_operations on the heap. It will also allocate the internal array of operation on the heap.

When you no longer needthe as_operations, you can release the resources allocated to it via as_operations_destroy().

Destruction

When you no longer require an as_operations, you should call as_operations_destroy() to release it and associated resources.

Usage

as_operations is a sequence of operations to be applied to a record.

Each of the following operations is added to the end of the sequence of operations.

When you have compiled the sequence of operations you want to execute, then you will send it to aerospike_key_operate().

Modifying a String

Aerospike allows you to append a string to a bin containing a string.

The following appends a "abc" to bin "bin1".

as_operations_add_append_str(ops, "bin1", "abc");

There is also a prepend operation, which will add the string to the beginning of the bin's current value.

as_operations_add_prepend_str(ops, "bin1", "abc");

Modifying a Byte Array

Aerospike allows you to append a byte array to a bin containing a byte array.

The following appends a 4 byte sequence to bin "bin1".

uint8_t raw[4] = { 1, 2, 3, 4 };
as_operations_add_append_raw(ops, "bin1", raw, 4);

There is also a prepend operation, which will add the bytes to the beginning of the bin's current value.

uint8_t raw[4] = { 1, 2, 3, 4 };
as_operations_add_prepend_raw(ops, "bin1", raw, 4);

Increment an Integer

Aerospike allows you to increment the value of a bin

The following increments the value in bin "bin1" by 4.

as_operations_add_incr(ops, "bin1", 4);

Write a Value

Write a value into a bin. Overwriting previous value.

The following writes a string "xyz" to "bin1".

as_operations_add_write_str(ops, "bin1", "xyz");

Read a Value

Read a value from a bin. This is ideal, if you performed an operation on a bin, and want to read the new value.

The following reads the value of "bin1"

as_operations_add_read(ops, "bin1", "xyz");

Touch a Record

Touching a record will refresh its ttl and increment the generation of the record.

The following touches a record.

Definition at line 281 of file as_operations.h.

#include "as_operations.h"

+ Collaboration diagram for as_operations:

Data Fields

as_binops binops
 
uint16_t gen
 
uint32_t ttl
 

Private Attributes

bool _free
 

Related Functions

(Note that these are not member functions.)

enum  as_map_order
 
void as_map_policy_init (as_map_policy *policy)
 
void as_map_policy_set (as_map_policy *policy, as_map_order order, as_map_write_mode mode)
 
enum  as_map_return_type
 
enum  as_map_write_mode
 
static bool as_operations_add_append_raw (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size)
 
bool as_operations_add_append_rawp (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_append_str (as_operations *ops, const as_bin_name name, const char *value)
 
bool as_operations_add_append_strp (as_operations *ops, const as_bin_name name, const char *value, bool free)
 
bool as_operations_add_incr (as_operations *ops, const as_bin_name name, int64_t value)
 
bool as_operations_add_incr_double (as_operations *ops, const as_bin_name name, double value)
 
bool as_operations_add_list_append (as_operations *ops, const as_bin_name name, as_val *val)
 
bool as_operations_add_list_append_double (as_operations *ops, const as_bin_name name, double value)
 
bool as_operations_add_list_append_int64 (as_operations *ops, const as_bin_name name, int64_t value)
 
bool as_operations_add_list_append_items (as_operations *ops, const as_bin_name name, as_list *list)
 
static bool as_operations_add_list_append_raw (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size)
 
bool as_operations_add_list_append_rawp (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_list_append_str (as_operations *ops, const as_bin_name name, const char *value)
 
bool as_operations_add_list_append_strp (as_operations *ops, const as_bin_name name, const char *value, bool free)
 
bool as_operations_add_list_clear (as_operations *ops, const as_bin_name name)
 
bool as_operations_add_list_get (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_get_range (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count)
 
bool as_operations_add_list_get_range_from (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_increment (as_operations *ops, const as_bin_name name, int64_t index, as_val *incr)
 
bool as_operations_add_list_insert (as_operations *ops, const as_bin_name name, int64_t index, as_val *val)
 
bool as_operations_add_list_insert_double (as_operations *ops, const as_bin_name name, int64_t index, double value)
 
bool as_operations_add_list_insert_int64 (as_operations *ops, const as_bin_name name, int64_t index, int64_t value)
 
bool as_operations_add_list_insert_items (as_operations *ops, const as_bin_name name, int64_t index, as_list *list)
 
static bool as_operations_add_list_insert_raw (as_operations *ops, const as_bin_name name, int64_t index, const uint8_t *value, uint32_t size)
 
bool as_operations_add_list_insert_rawp (as_operations *ops, const as_bin_name name, int64_t index, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_list_insert_str (as_operations *ops, const as_bin_name name, int64_t index, const char *value)
 
bool as_operations_add_list_insert_strp (as_operations *ops, const as_bin_name name, int64_t index, const char *value, bool free)
 
bool as_operations_add_list_pop (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_pop_range (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count)
 
bool as_operations_add_list_pop_range_from (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_remove (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_remove_range (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count)
 
bool as_operations_add_list_remove_range_from (as_operations *ops, const as_bin_name name, int64_t index)
 
bool as_operations_add_list_set (as_operations *ops, const as_bin_name name, int64_t index, as_val *val)
 
bool as_operations_add_list_set_double (as_operations *ops, const as_bin_name name, int64_t index, double value)
 
bool as_operations_add_list_set_int64 (as_operations *ops, const as_bin_name name, int64_t index, int64_t value)
 
static bool as_operations_add_list_set_raw (as_operations *ops, const as_bin_name name, int64_t index, const uint8_t *value, uint32_t size)
 
bool as_operations_add_list_set_rawp (as_operations *ops, const as_bin_name name, int64_t index, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_list_set_str (as_operations *ops, const as_bin_name name, int64_t index, const char *value)
 
bool as_operations_add_list_set_strp (as_operations *ops, const as_bin_name name, int64_t index, const char *value, bool free)
 
bool as_operations_add_list_size (as_operations *ops, const as_bin_name name)
 
bool as_operations_add_list_trim (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count)
 
bool as_operations_add_map_clear (as_operations *ops, const as_bin_name name)
 
bool as_operations_add_map_decrement (as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)
 
bool as_operations_add_map_get_by_index (as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_index_range (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_index_range_to_end (as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_key (as_operations *ops, const as_bin_name name, as_val *key, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_key_range (as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_rank (as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_rank_range (as_operations *ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_rank_range_to_end (as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_value (as_operations *ops, const as_bin_name name, as_val *value, as_map_return_type return_type)
 
bool as_operations_add_map_get_by_value_range (as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
 
bool as_operations_add_map_increment (as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)
 
bool as_operations_add_map_put (as_operations *ops, const as_bin_name name, as_map_policy *policy, as_val *key, as_val *value)
 
bool as_operations_add_map_put_items (as_operations *ops, const as_bin_name name, as_map_policy *policy, as_map *items)
 
bool as_operations_add_map_remove_by_index (as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_index_range (as_operations *ops, const as_bin_name name, int64_t index, uint64_t count, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_index_range_to_end (as_operations *ops, const as_bin_name name, int64_t index, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_key (as_operations *ops, const as_bin_name name, as_val *key, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_key_list (as_operations *ops, const as_bin_name name, as_list *keys, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_key_range (as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_rank (as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_rank_range (as_operations *ops, const as_bin_name name, int64_t rank, uint64_t count, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_rank_range_to_end (as_operations *ops, const as_bin_name name, int64_t rank, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_value (as_operations *ops, const as_bin_name name, as_val *value, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_value_list (as_operations *ops, const as_bin_name name, as_list *items, as_map_return_type return_type)
 
bool as_operations_add_map_remove_by_value_range (as_operations *ops, const as_bin_name name, as_val *begin, as_val *end, as_map_return_type return_type)
 
bool as_operations_add_map_set_policy (as_operations *ops, const as_bin_name name, as_map_policy *policy)
 
bool as_operations_add_map_size (as_operations *ops, const as_bin_name name)
 
static bool as_operations_add_prepend_raw (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size)
 
bool as_operations_add_prepend_rawp (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_prepend_str (as_operations *ops, const as_bin_name name, const char *value)
 
bool as_operations_add_prepend_strp (as_operations *ops, const as_bin_name name, const char *value, bool free)
 
bool as_operations_add_read (as_operations *ops, const as_bin_name name)
 
bool as_operations_add_touch (as_operations *ops)
 
bool as_operations_add_write (as_operations *ops, const as_bin_name name, as_bin_value *value)
 
bool as_operations_add_write_double (as_operations *ops, const as_bin_name name, double value)
 
static bool as_operations_add_write_geojson_str (as_operations *ops, const as_bin_name name, const char *value)
 
bool as_operations_add_write_geojson_strp (as_operations *ops, const as_bin_name name, const char *value, bool free)
 
bool as_operations_add_write_int64 (as_operations *ops, const as_bin_name name, int64_t value)
 
static bool as_operations_add_write_raw (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size)
 
bool as_operations_add_write_rawp (as_operations *ops, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_write_str (as_operations *ops, const as_bin_name name, const char *value)
 
bool as_operations_add_write_strp (as_operations *ops, const as_bin_name name, const char *value, bool free)
 
void as_operations_destroy (as_operations *ops)
 
as_operationsas_operations_init (as_operations *ops, uint16_t nops)
 
#define as_operations_inita(__ops, __nops)
 
as_operationsas_operations_new (uint16_t nops)
 

Friends And Related Function Documentation

enum as_map_order
related

Map storage order.

Definition at line 35 of file as_map_operations.h.

void as_map_policy_init ( as_map_policy policy)
related

Initialize map attributes to default unordered map with standard overwrite semantics.

void as_map_policy_set ( as_map_policy policy,
as_map_order  order,
as_map_write_mode  mode 
)
related

Set map attributes to specified map order and write mode semantics.

enum as_map_return_type
related

Map return type. Type of data to return when selecting or removing items from the map.

Definition at line 96 of file as_map_operations.h.

enum as_map_write_mode
related

Map write mode.

Definition at line 58 of file as_map_operations.h.

static bool as_operations_add_append_raw ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size 
)
related

Add a AS_OPERATOR_APPEND bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
sizeThe size of the value.
Returns
true on success. Otherwise an error occurred.

Definition at line 707 of file as_operations.h.

References as_operations_add_append_rawp().

bool as_operations_add_append_rawp ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Add a AS_OPERATOR_APPEND bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
sizeThe size of the value.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_append_str ( as_operations ops,
const as_bin_name  name,
const char *  value 
)
related

Add a AS_OPERATOR_APPEND bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
Returns
true on success. Otherwise an error occurred.

Definition at line 673 of file as_operations.h.

References as_operations_add_append_strp().

bool as_operations_add_append_strp ( as_operations ops,
const as_bin_name  name,
const char *  value,
bool  free 
)
related

Add a AS_OPERATOR_APPEND bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_incr ( as_operations ops,
const as_bin_name  name,
int64_t  value 
)
related

Add a AS_OPERATOR_INCR bin operation with (required) int64_t value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_incr_double ( as_operations ops,
const as_bin_name  name,
double  value 
)
related

Add a AS_OPERATOR_INCR bin operation with double value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_append ( as_operations ops,
const as_bin_name  name,
as_val val 
)
related

Add an as_val element to end of list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valValue to append. Consumes a reference of this as_val.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_append_double ( as_operations ops,
const as_bin_name  name,
double  value 
)
related

Add a double to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueA double value.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_append_int64 ( as_operations ops,
const as_bin_name  name,
int64_t  value 
)
related

Add an integer to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueAn integer value.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_append_items ( as_operations ops,
const as_bin_name  name,
as_list list 
)
related

Add multiple values to end of list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
listList of values to append. Consumes a reference of this as_list.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_append_raw ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size 
)
related

Add a blob to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueA blob.
sizeSize of the blob.
Returns
true on success. Otherwise an error occurred.

Definition at line 139 of file as_list_operations.h.

References as_operations_add_list_append_rawp().

bool as_operations_add_list_append_rawp ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Add a blob to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueA blob.
sizeSize of the blob.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_append_str ( as_operations ops,
const as_bin_name  name,
const char *  value 
)
related

Add a string to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueA c-string.
Returns
true on success. Otherwise an error occurred.

Definition at line 103 of file as_list_operations.h.

References as_operations_add_list_append_strp().

bool as_operations_add_list_append_strp ( as_operations ops,
const as_bin_name  name,
const char *  value,
bool  free 
)
related

Add a string to end of list. Convenience function of as_operations_add_list_append()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueA c-string.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_clear ( as_operations ops,
const as_bin_name  name 
)
related

Remove all values. Will leave empty list in bin.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_get ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Get value of list at index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to get. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_get_range ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count 
)
related

Get multiple values of list starting at index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start. Negative index counts from end of list.
countNumber of values to get. If not enough in list, will return all remaining.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_get_range_from ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Get multiple values of list starting at index until end of list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_increment ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_val incr 
)
related

Create list increment operation. Server increments value at index by incr and returns final result. Valid only for numbers.

bool as_operations_add_list_insert ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_val val 
)
related

Insert an as_val element to list at index position.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the as_val will be inserted at. Negative index counts from end of list.
valValue to insert. Consumes a reference of this as_list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_insert_double ( as_operations ops,
const as_bin_name  name,
int64_t  index,
double  value 
)
related

Insert double to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the double will be inserted at. Negative index counts from end of list.
valueA double value.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_insert_int64 ( as_operations ops,
const as_bin_name  name,
int64_t  index,
int64_t  value 
)
related

Insert integer to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the integer will be inserted at. Negative index counts from end of list.
valueAn integer value.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_insert_items ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_list list 
)
related

Insert multiple values to list at index position.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the blob will be inserted at. Negative index counts from end of list.
listList of values to insert. Consumes reference of list.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_insert_raw ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const uint8_t *  value,
uint32_t  size 
)
related

Insert blob to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the blob will be inserted at. Negative index counts from end of list.
valueA blob.
sizeSize of the blob.
Returns
true on success. Otherwise an error occurred.

Definition at line 276 of file as_list_operations.h.

References as_operations_add_list_insert_rawp().

bool as_operations_add_list_insert_rawp ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Insert blob to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the blob will be inserted at. Negative index counts from end of list.
valueA blob.
sizeSize of the blob.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_insert_str ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const char *  value 
)
related

Insert string to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the string will be inserted at. Negative index counts from end of list.
valueA c-string.
Returns
true on success. Otherwise an error occurred.

Definition at line 238 of file as_list_operations.h.

References as_operations_add_list_insert_strp().

bool as_operations_add_list_insert_strp ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const char *  value,
bool  free 
)
related

Insert string to list at index position. Convenience function of as_operations_add_list_insert()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position which the string will be inserted at. Negative index counts from end of list.
valueA c-string.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_pop ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Remove and return a value at index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which the value will be removed and returned. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_pop_range ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count 
)
related

Remove and return N values from index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start the removal. Negative index counts from end of list.
countNumber of values to remove. If not enough values in list, will remove to list end.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_pop_range_from ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Remove and return all values from index to the end of list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start the removal. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_remove ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Remove value at index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start the removal. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_remove_range ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count 
)
related

Remove N values from index.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start the removal. Negative index counts from end of list.
countNumber of values to remove. If not enough values in list, will remove to list end.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_remove_range_from ( as_operations ops,
const as_bin_name  name,
int64_t  index 
)
related

Remove all values from index until end of list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position at which to start the removal. Negative index counts from end of list.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_set ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_val val 
)
related

Set an as_val element of the list at the index position.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valConsumes a reference of this as_val.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_set_double ( as_operations ops,
const as_bin_name  name,
int64_t  index,
double  value 
)
related

Set value at index as double. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueA double value.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_set_int64 ( as_operations ops,
const as_bin_name  name,
int64_t  index,
int64_t  value 
)
related

Set value at index as integer. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueAn integer value.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_set_raw ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const uint8_t *  value,
uint32_t  size 
)
related

Set value at index as blob. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueA blob.
sizeSize of the blob.
Returns
true on success. Otherwise an error occurred.

Definition at line 523 of file as_list_operations.h.

References as_operations_add_list_set_rawp().

bool as_operations_add_list_set_rawp ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Set value at index as blob. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueA blob.
sizeSize of the blob.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_list_set_str ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const char *  value 
)
related

Set value at index as string. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueA c-string.
Returns
true on success. Otherwise an error occurred.

Definition at line 485 of file as_list_operations.h.

References as_operations_add_list_set_strp().

bool as_operations_add_list_set_strp ( as_operations ops,
const as_bin_name  name,
int64_t  index,
const char *  value,
bool  free 
)
related

Set value at index as string. Convenience function of as_operations_add_list_set()

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexIndex position to set. Negative index counts from end of list.
valueA c-string.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_size ( as_operations ops,
const as_bin_name  name 
)
related

Get number of values in list.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_list_trim ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count 
)
related

Remove values NOT within range(index, count).

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
indexValues from 0-index position are removed. Negative index counts from end of list.
countNumber of values to keep. All other values beyond count are removed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_map_clear ( as_operations ops,
const as_bin_name  name 
)
related

Create map clear operation. Server removes all items in map. Server returns null.

bool as_operations_add_map_decrement ( as_operations ops,
const as_bin_name  name,
as_map_policy policy,
as_val key,
as_val value 
)
related

Create map decrement operation. Server decrement values by decr for all items identified by key and returns final result. Valid only for numbers.

The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See as_map_policy and as_map_write_mode.

bool as_operations_add_map_get_by_index ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_map_return_type  return_type 
)
related

Create map get by index operation. Server selects map item identified by index and returns selected data specified by return_type.

bool as_operations_add_map_get_by_index_range ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count,
as_map_return_type  return_type 
)
related

Create map get by index range operation. Server selects count map items starting at specified index and returns selected data specified by return_type.

bool as_operations_add_map_get_by_index_range_to_end ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_map_return_type  return_type 
)
related

Create map get by index range operation. Server selects map items starting at specified index to the end of map and returns selected data specified by return_type.

bool as_operations_add_map_get_by_key ( as_operations ops,
const as_bin_name  name,
as_val key,
as_map_return_type  return_type 
)
related

Create map get by key operation. Server selects map item identified by key and returns selected data specified by return_type.

bool as_operations_add_map_get_by_key_range ( as_operations ops,
const as_bin_name  name,
as_val begin,
as_val end,
as_map_return_type  return_type 
)
related

Create map get by key range operation. Server selects map items identified by key range (begin inclusive, end exclusive). If begin is null, the range is less than end. If end is null, the range is greater than equal to begin.

Server returns selected data specified by return_type.

bool as_operations_add_map_get_by_rank ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
as_map_return_type  return_type 
)
related

Create map get by rank operation. Server selects map item identified by rank and returns selected data specified by return_type.

bool as_operations_add_map_get_by_rank_range ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
uint64_t  count,
as_map_return_type  return_type 
)
related

Create map get by rank range operation. Server selects count map items starting at specified rank and returns selected data specified by return_type.

bool as_operations_add_map_get_by_rank_range_to_end ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
as_map_return_type  return_type 
)
related

Create map get by rank range operation. Server selects map items starting at specified rank to the last ranked item and returns selected data specified by return_type.

bool as_operations_add_map_get_by_value ( as_operations ops,
const as_bin_name  name,
as_val value,
as_map_return_type  return_type 
)
related

Create map get by value operation. Server selects map items identified by value and returns selected data specified by return_type.

bool as_operations_add_map_get_by_value_range ( as_operations ops,
const as_bin_name  name,
as_val begin,
as_val end,
as_map_return_type  return_type 
)
related

Create map get by value range operation. Server selects map items identified by value range (begin inclusive, end exclusive). If begin is null, the range is less than end. If end is null, the range is greater than equal to begin.

Server returns selected data specified by return_type.

bool as_operations_add_map_increment ( as_operations ops,
const as_bin_name  name,
as_map_policy policy,
as_val key,
as_val value 
)
related

Create map increment operation. Server increments values by incr for all items identified by key and returns final result. Valid only for numbers.

The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See as_map_policy and as_map_write_mode.

bool as_operations_add_map_put ( as_operations ops,
const as_bin_name  name,
as_map_policy policy,
as_val key,
as_val value 
)
related

Create map put operation. Server writes key/value item to map bin and returns map size.

The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See as_map_policy and as_map_write_mode.

bool as_operations_add_map_put_items ( as_operations ops,
const as_bin_name  name,
as_map_policy policy,
as_map items 
)
related

Create map put items operation. Server writes each map item to map bin and returns map size.

The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map. See as_map_policy and as_map_write_mode.

bool as_operations_add_map_remove_by_index ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map item identified by index and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_index_range ( as_operations ops,
const as_bin_name  name,
int64_t  index,
uint64_t  count,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes count map items starting at specified index and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_index_range_to_end ( as_operations ops,
const as_bin_name  name,
int64_t  index,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items starting at specified index to the end of map and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_key ( as_operations ops,
const as_bin_name  name,
as_val key,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map item identified by key and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_key_list ( as_operations ops,
const as_bin_name  name,
as_list keys,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items identified by keys and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_key_range ( as_operations ops,
const as_bin_name  name,
as_val begin,
as_val end,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items identified by key range (begin inclusive, end exclusive). If begin is null, the range is less than end. If end is null, the range is greater than equal to begin.

Server returns removed data specified by return_type.

bool as_operations_add_map_remove_by_rank ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map item identified by rank and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_rank_range ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
uint64_t  count,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes count map items starting at specified rank and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_rank_range_to_end ( as_operations ops,
const as_bin_name  name,
int64_t  rank,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items starting at specified rank to the last ranked item and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_value ( as_operations ops,
const as_bin_name  name,
as_val value,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items identified by value and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_value_list ( as_operations ops,
const as_bin_name  name,
as_list items,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items identified by values and returns removed data specified by return_type.

bool as_operations_add_map_remove_by_value_range ( as_operations ops,
const as_bin_name  name,
as_val begin,
as_val end,
as_map_return_type  return_type 
)
related

Create map remove operation. Server removes map items identified by value range (begin inclusive, end exclusive). If begin is null, the range is less than end. If end is null, the range is greater than equal to begin.

Server returns removed data specified by return_type.

bool as_operations_add_map_set_policy ( as_operations ops,
const as_bin_name  name,
as_map_policy policy 
)
related

Create set map policy operation. Server sets map policy attributes. Server does not return a value.

bool as_operations_add_map_size ( as_operations ops,
const as_bin_name  name 
)
related

Create map size operation. Server returns size of map.

static bool as_operations_add_prepend_raw ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size 
)
related

Add a AS_OPERATOR_PREPEND bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
sizeThe size of the value.
Returns
true on success. Otherwise an error occurred.

Definition at line 641 of file as_operations.h.

References as_operations_add_prepend_rawp().

bool as_operations_add_prepend_rawp ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Add a AS_OPERATOR_PREPEND bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
sizeThe size of the value.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_prepend_str ( as_operations ops,
const as_bin_name  name,
const char *  value 
)
related

Add a AS_OPERATOR_PREPEND bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
Returns
true on success. Otherwise an error occurred.

Definition at line 607 of file as_operations.h.

References as_operations_add_prepend_strp().

bool as_operations_add_prepend_strp ( as_operations ops,
const as_bin_name  name,
const char *  value,
bool  free 
)
related

Add a AS_OPERATOR_PREPEND bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_read ( as_operations ops,
const as_bin_name  name 
)
related

Add a AS_OPERATOR_READ bin operation.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_touch ( as_operations ops)
related

Add a AS_OPERATOR_TOUCH record operation.

Parameters
opsThe as_operations to append the operation to.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_write ( as_operations ops,
const as_bin_name  name,
as_bin_value value 
)
related

Add a AS_OPERATOR_WRITE bin operation.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_write_double ( as_operations ops,
const as_bin_name  name,
double  value 
)
related

Add a AS_OPERATOR_WRITE bin operation with a double value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_write_geojson_str ( as_operations ops,
const as_bin_name  name,
const char *  value 
)
related

Add a AS_OPERATOR_WRITE bin operation with a NULL-terminated GeoJSON string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
Returns
true on success. Otherwise an error occurred.

Definition at line 500 of file as_operations.h.

References as_operations_add_write_geojson_strp().

bool as_operations_add_write_geojson_strp ( as_operations ops,
const as_bin_name  name,
const char *  value,
bool  free 
)
related

Add a AS_OPERATOR_WRITE bin operation with a NULL-terminated GeoJSON string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
bool as_operations_add_write_int64 ( as_operations ops,
const as_bin_name  name,
int64_t  value 
)
related

Add a AS_OPERATOR_WRITE bin operation with an int64_t value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_write_raw ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size 
)
related

Add a AS_OPERATOR_WRITE bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
sizeThe size of the value. Must last for the lifetime of the operations.
Returns
true on success. Otherwise an error occurred.

Definition at line 534 of file as_operations.h.

References as_operations_add_write_rawp().

bool as_operations_add_write_rawp ( as_operations ops,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size,
bool  free 
)
related

Add a AS_OPERATOR_WRITE bin operation with a raw bytes value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
sizeThe size of the value.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
static bool as_operations_add_write_str ( as_operations ops,
const as_bin_name  name,
const char *  value 
)
related

Add a AS_OPERATOR_WRITE bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation. Must last for the lifetime of the operations.
Returns
true on success. Otherwise an error occurred.

Definition at line 468 of file as_operations.h.

References as_operations_add_write_strp().

bool as_operations_add_write_strp ( as_operations ops,
const as_bin_name  name,
const char *  value,
bool  free 
)
related

Add a AS_OPERATOR_WRITE bin operation with a NULL-terminated string value.

Parameters
opsThe as_operations to append the operation to.
nameThe name of the bin to perform the operation on.
valueThe value to be used in the operation.
freeIf true, then the value will be freed when the operations is destroyed.
Returns
true on success. Otherwise an error occurred.
void as_operations_destroy ( as_operations ops)
related

Destroy an as_operations and release associated resources.

Parameters
opsThe as_operations to destroy.
as_operations * as_operations_init ( as_operations ops,
uint16_t  nops 
)
related

Intializes a stack allocated as_operations.

as_operations_add_incr(&ops, "bin1", 123);
as_operations_add_append_str(&ops, "bin2", "abc");

Use as_operations_destroy() to free the resources allocated to the as_operations.

Parameters
opsThe as_operations to initialize.
nopsThe number of as_operations.binops.entries to allocate on the heap.
Returns
The initialized as_operations on success. Otherwise NULL.
#define as_operations_inita (   __ops,
  __nops 
)
related
Value:
(__ops)->_free = false;\
(__ops)->gen = 0;\
(__ops)->ttl = 0;\
(__ops)->binops._free = false;\
(__ops)->binops.capacity = (__nops);\
(__ops)->binops.size = 0;\
(__ops)->binops.entries = (as_binop*) alloca(sizeof(as_binop) * (__nops));

Initializes a stack allocated as_operations (as_operations) and allocates __nops number of entries on the stack.

as_operations_add_incr(&ops, "bin1", 123);
as_operations_add_append_str(&ops, "bin2", "abc");
Parameters
__opsThe as_operations * to initialize.
__nopsThe number of as_binops.entries to allocate on the stack.

Definition at line 328 of file as_operations.h.

as_operations * as_operations_new ( uint16_t  nops)
related

Create and initialize a heap allocated as_operations.

as_operations_add_incr(ops, "bin1", 123);
as_operations_add_append_str(ops, "bin2", "abc");

Use as_operations_destroy() to free the resources allocated to the as_operations.

Parameters
nopsThe number of as_operations.binops.entries to allocate on the heap.
Returns
The new as_operations on success. Otherwise NULL.

Field Documentation

bool as_operations::_free
private

If true, then as_operations_destroy() will free this instance.

Definition at line 287 of file as_operations.h.

as_binops as_operations::binops

Operations to be performed on the bins of a record.

Definition at line 302 of file as_operations.h.

uint16_t as_operations::gen

The generation of the record.

Definition at line 292 of file as_operations.h.

uint32_t as_operations::ttl

The time-to-live (expiration) of the record in seconds.

Definition at line 297 of file as_operations.h.


The documentation for this struct was generated from the following files: