Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
Base Operations

Description

Basic single record read/write/delete/touch operations.

+ Collaboration diagram for Base Operations:

Data Structures

struct  as_cdt_ctx
 
struct  as_cdt_ctx_item
 
struct  as_operations
 

Enumerations

enum  as_cdt_ctx_type
 

Functions

static void as_cdt_ctx_add_list_index (as_cdt_ctx *ctx, int index)
 
static void as_cdt_ctx_add_list_index_create (as_cdt_ctx *ctx, int index, as_list_order order, bool pad)
 
static void as_cdt_ctx_add_list_rank (as_cdt_ctx *ctx, int rank)
 
static void as_cdt_ctx_add_list_value (as_cdt_ctx *ctx, as_val *val)
 
static void as_cdt_ctx_add_map_index (as_cdt_ctx *ctx, int index)
 
static void as_cdt_ctx_add_map_key (as_cdt_ctx *ctx, as_val *key)
 
static void as_cdt_ctx_add_map_key_create (as_cdt_ctx *ctx, as_val *key, as_map_order order)
 
static void as_cdt_ctx_add_map_rank (as_cdt_ctx *ctx, int rank)
 
static void as_cdt_ctx_add_map_value (as_cdt_ctx *ctx, as_val *val)
 
static as_cdt_ctxas_cdt_ctx_create (uint32_t capacity)
 
AS_EXTERN void as_cdt_ctx_destroy (as_cdt_ctx *ctx)
 
static void as_cdt_ctx_init (as_cdt_ctx *ctx, uint32_t capacity)
 
static bool as_operations_add_append_raw (as_operations *ops, const char *name, const uint8_t *value, uint32_t size)
 
AS_EXTERN bool as_operations_add_append_rawp (as_operations *ops, const char *name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_append_str (as_operations *ops, const char *name, const char *value)
 
AS_EXTERN bool as_operations_add_append_strp (as_operations *ops, const char *name, const char *value, bool free)
 
AS_EXTERN bool as_operations_add_delete (as_operations *ops)
 
AS_EXTERN bool as_operations_add_incr (as_operations *ops, const char *name, int64_t value)
 
AS_EXTERN bool as_operations_add_incr_double (as_operations *ops, const char *name, double value)
 
static bool as_operations_add_prepend_raw (as_operations *ops, const char *name, const uint8_t *value, uint32_t size)
 
AS_EXTERN bool as_operations_add_prepend_rawp (as_operations *ops, const char *name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_prepend_str (as_operations *ops, const char *name, const char *value)
 
AS_EXTERN bool as_operations_add_prepend_strp (as_operations *ops, const char *name, const char *value, bool free)
 
AS_EXTERN bool as_operations_add_read (as_operations *ops, const char *name)
 
AS_EXTERN bool as_operations_add_read_all (as_operations *ops)
 
AS_EXTERN bool as_operations_add_touch (as_operations *ops)
 
AS_EXTERN bool as_operations_add_write (as_operations *ops, const char *name, as_bin_value *value)
 
AS_EXTERN bool as_operations_add_write_bool (as_operations *ops, const char *name, bool value)
 
AS_EXTERN bool as_operations_add_write_double (as_operations *ops, const char *name, double value)
 
static bool as_operations_add_write_geojson_str (as_operations *ops, const char *name, const char *value)
 
AS_EXTERN bool as_operations_add_write_geojson_strp (as_operations *ops, const char *name, const char *value, bool free)
 
AS_EXTERN bool as_operations_add_write_int64 (as_operations *ops, const char *name, int64_t value)
 
static bool as_operations_add_write_raw (as_operations *ops, const char *name, const uint8_t *value, uint32_t size)
 
AS_EXTERN bool as_operations_add_write_rawp (as_operations *ops, const char *name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_operations_add_write_str (as_operations *ops, const char *name, const char *value)
 
AS_EXTERN bool as_operations_add_write_strp (as_operations *ops, const char *name, const char *value, bool free)
 
AS_EXTERN void as_operations_destroy (as_operations *ops)
 
AS_EXTERN as_operationsas_operations_init (as_operations *ops, uint16_t nops)
 
AS_EXTERN as_operationsas_operations_new (uint16_t nops)
 

Enumeration Type Documentation

◆ as_cdt_ctx_type

enum as_cdt_ctx_type
related

Nested CDT context type.

Definition at line 37 of file as_cdt_ctx.h.

Function Documentation

◆ as_cdt_ctx_add_list_index()

static void as_cdt_ctx_add_list_index ( as_cdt_ctx * ctx,
int index )
related

Lookup list by index offset.

If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. Examples:

  • 0: First item.
  • 4: Fifth item.
  • -1: Last item.
  • -3: Third to last item.

Definition at line 154 of file as_cdt_ctx.h.

References AS_CDT_CTX_LIST_INDEX, as_vector_append(), as_cdt_ctx_item::ival, as_cdt_ctx::list, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_list_index_create()

static void as_cdt_ctx_add_list_index_create ( as_cdt_ctx * ctx,
int index,
as_list_order order,
bool pad )
related

Create list with given type at index offset.

Definition at line 169 of file as_cdt_ctx.h.

References AS_CDT_CTX_LIST_INDEX, as_list_order_to_flag(), as_vector_append(), as_cdt_ctx_item::ival, as_cdt_ctx::list, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_list_rank()

static void as_cdt_ctx_add_list_rank ( as_cdt_ctx * ctx,
int rank )
related

Lookup list by rank.

  • 0 = smallest value
  • N = Nth smallest value
  • -1 = largest value

Definition at line 189 of file as_cdt_ctx.h.

References AS_CDT_CTX_LIST_RANK, as_vector_append(), as_cdt_ctx_item::ival, as_cdt_ctx::list, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_list_value()

static void as_cdt_ctx_add_list_value ( as_cdt_ctx * ctx,
as_val * val )
related

Lookup list by value. The ctx list takes ownership of val.

Definition at line 204 of file as_cdt_ctx.h.

References AS_CDT_CTX_LIST_VALUE, as_vector_append(), as_cdt_ctx::list, as_cdt_ctx_item::pval, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_map_index()

static void as_cdt_ctx_add_map_index ( as_cdt_ctx * ctx,
int index )
related

Lookup map by index offset.

If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. Examples:

  • 0: First item.
  • 4: Fifth item.
  • -1: Last item.
  • -3: Third to last item.

Definition at line 228 of file as_cdt_ctx.h.

References AS_CDT_CTX_MAP_INDEX, as_vector_append(), as_cdt_ctx_item::ival, as_cdt_ctx::list, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_map_key()

static void as_cdt_ctx_add_map_key ( as_cdt_ctx * ctx,
as_val * key )
related

Lookup map by key. The ctx list takes ownership of key.

Definition at line 263 of file as_cdt_ctx.h.

References AS_CDT_CTX_MAP_KEY, as_vector_append(), as_cdt_ctx::list, as_cdt_ctx_item::pval, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_map_key_create()

static void as_cdt_ctx_add_map_key_create ( as_cdt_ctx * ctx,
as_val * key,
as_map_order order )
related

Create map with given type at map key. The ctx list takes ownership of key.

Definition at line 279 of file as_cdt_ctx.h.

References AS_CDT_CTX_MAP_KEY, as_map_order_to_flag(), as_vector_append(), as_cdt_ctx::list, as_cdt_ctx_item::pval, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_map_rank()

static void as_cdt_ctx_add_map_rank ( as_cdt_ctx * ctx,
int rank )
related

Lookup map by rank.

  • 0 = smallest value
  • N = Nth smallest value
  • -1 = largest value

Definition at line 248 of file as_cdt_ctx.h.

References AS_CDT_CTX_MAP_RANK, as_vector_append(), as_cdt_ctx_item::ival, as_cdt_ctx::list, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_add_map_value()

static void as_cdt_ctx_add_map_value ( as_cdt_ctx * ctx,
as_val * val )
related

Lookup map by value. The ctx list takes ownership of val.

Definition at line 294 of file as_cdt_ctx.h.

References AS_CDT_CTX_MAP_VALUE, as_vector_append(), as_cdt_ctx::list, as_cdt_ctx_item::pval, as_cdt_ctx_item::type, and as_cdt_ctx_item::val.

◆ as_cdt_ctx_create()

static as_cdt_ctx * as_cdt_ctx_create ( uint32_t capacity)
related

Initialize a heap allocated nested CDT context list, with item storage on the heap. Call as_cdt_ctx_destroy() when done with the context list.

Definition at line 124 of file as_cdt_ctx.h.

References as_vector_create().

◆ as_cdt_ctx_destroy()

AS_EXTERN void as_cdt_ctx_destroy ( as_cdt_ctx * ctx)
related

Destroy nested CDT context list and as_val based context items that were allocated on the heap.

◆ as_cdt_ctx_init()

static void as_cdt_ctx_init ( as_cdt_ctx * ctx,
uint32_t capacity )
related

Initialize a stack allocated nested CDT context list, with item storage on the heap. Call as_cdt_ctx_destroy() when done with the context list.

Definition at line 111 of file as_cdt_ctx.h.

References as_vector_init(), and as_cdt_ctx::list.

◆ as_operations_add_append_raw()

static bool as_operations_add_append_raw ( as_operations * ops,
const char * 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 747 of file as_operations.h.

◆ as_operations_add_append_rawp()

AS_EXTERN bool as_operations_add_append_rawp ( as_operations * ops,
const char * 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.

◆ as_operations_add_append_str()

static bool as_operations_add_append_str ( as_operations * ops,
const char * 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 711 of file as_operations.h.

◆ as_operations_add_append_strp()

AS_EXTERN bool as_operations_add_append_strp ( as_operations * ops,
const char * 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.

◆ as_operations_add_delete()

AS_EXTERN bool as_operations_add_delete ( as_operations * ops)
related

Add a AS_OPERATOR_DELETE record operation.

Parameters
opsThe as_operations to append the operation to.
Returns
true on success. Otherwise an error occurred.

◆ as_operations_add_incr()

AS_EXTERN bool as_operations_add_incr ( as_operations * ops,
const char * name,
int64_t value )
related

Add a AS_OPERATOR_INCR bin operation with int64_t value. If the record or bin does not exist, the record/bin will be created by default with the value to be added.

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.

◆ as_operations_add_incr_double()

AS_EXTERN bool as_operations_add_incr_double ( as_operations * ops,
const char * name,
double value )
related

Add a AS_OPERATOR_INCR bin operation with double value. If the record or bin does not exist, the record/bin will be created by default with the value to be added.

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.

◆ as_operations_add_prepend_raw()

static bool as_operations_add_prepend_raw ( as_operations * ops,
const char * 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 677 of file as_operations.h.

◆ as_operations_add_prepend_rawp()

AS_EXTERN bool as_operations_add_prepend_rawp ( as_operations * ops,
const char * 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.

◆ as_operations_add_prepend_str()

static bool as_operations_add_prepend_str ( as_operations * ops,
const char * 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 641 of file as_operations.h.

◆ as_operations_add_prepend_strp()

AS_EXTERN bool as_operations_add_prepend_strp ( as_operations * ops,
const char * 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.

◆ as_operations_add_read()

AS_EXTERN bool as_operations_add_read ( as_operations * ops,
const char * 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.

◆ as_operations_add_read_all()

AS_EXTERN bool as_operations_add_read_all ( as_operations * ops)
related

Create read all bins database operation.

Parameters
opsThe as_operations to append the operation to.
Returns
true on success. Otherwise an error occurred.

◆ as_operations_add_touch()

AS_EXTERN 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.

◆ as_operations_add_write()

AS_EXTERN bool as_operations_add_write ( as_operations * ops,
const char * 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.

◆ as_operations_add_write_bool()

AS_EXTERN bool as_operations_add_write_bool ( as_operations * ops,
const char * name,
bool value )
related

Add a AS_OPERATOR_WRITE bin operation with an bool 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.

◆ as_operations_add_write_double()

AS_EXTERN bool as_operations_add_write_double ( as_operations * ops,
const char * 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.

◆ as_operations_add_write_geojson_str()

static bool as_operations_add_write_geojson_str ( as_operations * ops,
const char * 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 512 of file as_operations.h.

◆ as_operations_add_write_geojson_strp()

AS_EXTERN bool as_operations_add_write_geojson_strp ( as_operations * ops,
const char * 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.

◆ as_operations_add_write_int64()

AS_EXTERN bool as_operations_add_write_int64 ( as_operations * ops,
const char * 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.

◆ as_operations_add_write_raw()

static bool as_operations_add_write_raw ( as_operations * ops,
const char * 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 548 of file as_operations.h.

◆ as_operations_add_write_rawp()

AS_EXTERN bool as_operations_add_write_rawp ( as_operations * ops,
const char * 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.

◆ as_operations_add_write_str()

static bool as_operations_add_write_str ( as_operations * ops,
const char * 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 478 of file as_operations.h.

◆ as_operations_add_write_strp()

AS_EXTERN bool as_operations_add_write_strp ( as_operations * ops,
const char * 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.

◆ as_operations_destroy()

AS_EXTERN void as_operations_destroy ( as_operations * ops)
related

Destroy an as_operations and release associated resources.

AS_EXTERN void as_operations_destroy(as_operations *ops)
as_binops binops
Parameters
opsThe as_operations to destroy.

◆ as_operations_init()

AS_EXTERN 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");
AS_EXTERN bool as_operations_add_incr(as_operations *ops, const char *name, int64_t value)
AS_EXTERN as_operations * as_operations_init(as_operations *ops, uint16_t nops)
static bool as_operations_add_append_str(as_operations *ops, const char *name, const char *value)

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.

◆ as_operations_new()

AS_EXTERN 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");
AS_EXTERN as_operations * as_operations_new(uint16_t nops)

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.