Loading...
Searching...
No Matches
Data Fields | Related Symbols
as_record Struct Reference

Detailed Description

Records in Aerospike are collections of named bins.

The bins in a record are analogous to columns in relational databases. However, unlike columns, the bins themselves are not typed. Instead, bins contain values which are typed. So, it is possible to have multiple records with bins of the same name but different types for values.

The bin's value can only be of the types defined in as_bin_value.

Initialization

There are several ways to initialize an as_record.

You can create the as_record on the stack:

Then initialize it using either the as_record_init() function or as_record_inita() macro.

The as_record_init() function will initialize the variable, then allocate the specified number of bins using malloc(). The following initializes rec with 2 bins.

as_record_init(&rec, 2);
AS_EXTERN as_record * as_record_init(as_record *rec, uint16_t nbins)

The as_record_inita() macro will initialize the variable, then allocate the specified number of bins using alloca(). The following initializes rec with 2 bins.

as_record_inita(&rec, 2);
#define as_record_inita(__rec, __nbins)
Definition as_record.h:254

The as_record_new() function will allocate an as_record on the heap using malloc() then allocate the specified number of bins using malloc(). The following creates a new as_record with 2 bins.

AS_EXTERN as_record * as_record_new(uint16_t nbins)

Destruction

When you no longer require an as_record, you should call as_record_destroy() to release the record and associated resources.

AS_EXTERN void as_record_destroy(as_record *rec)

If the record has been ref-counted, then the ref-count will be decremented, until it reaches 0 (zero), at which point, the record will be released.

Setting Bin Values

The following are functions for setting values in bins of a record. Utilize the appropriate setter for the data you want to store in a bin.

Function Description
as_record_set_int64() Set the bin value to a 64-bit integer.
as_record_set_str() Set the bin value to a NULL-terminated string.
as_record_set_integer() Set the bin value to an as_integer.
as_record_set_double() Set the bin value to an as_double.
as_record_set_string() Set the bin value to an as_string.
as_record_set_geojson() Set the bin value to an as_geojson.
as_record_set_bytes() Set the bin value to an as_bytes.
as_record_set_list() Set the bin value to an as_list.
as_record_set_map() Set the bin value to an as_map.
as_record_set_nil() Set the bin value to an as_nil.
as_record_set() Set the bin value to an as_bin_value.

Getting Bin Values

The following are functions for getting values from bins of a record. Utilize the appropriate getter for the data you want to read from a bin.

Function Description
as_record_get_int64() Get the bin as a 64-bit integer.
as_record_get_str() Get the bin as a NULL-terminated string.
as_record_get_integer() Get the bin as an as_integer.
as_record_get_double() Get the bin as an as_double.
as_record_get_string() Get the bin as an as_string.
as_record_get_geojson() Get the bin as an as_geojson.
as_record_get_bytes() Get the bin as an as_bytes.
as_record_get_list() Get the bin as an as_list.
as_record_get_map() Get the bin as an as_map.
as_record_get() Get the bin as an as_bin_value.

If you are unsure of the type of data stored in the bin, then you should use as_record_get(). You can then check the type of the value using as_val_type().

as_bin_value* value = as_record_get(rec, "bin1");
switch ( as_val_type(value) ) {
case AS_NIL: break;
case AS_INTEGER: break;
case AS_DOUBLE: break;
case AS_STRING: break;
case AS_GEOJSON: break;
case AS_BYTES: break;
case AS_LIST: break;
case AS_MAP: break;
case AS_REC: break;
case AS_UNDEF: break;
}
#define as_val_type(__v)
Definition as_val.h:95
@ AS_INTEGER
Definition as_val.h:39
@ AS_NIL
Definition as_val.h:37
@ AS_REC
Definition as_val.h:43
@ AS_UNDEF
Definition as_val.h:35
@ AS_DOUBLE
Definition as_val.h:46
@ AS_STRING
Definition as_val.h:40
@ AS_MAP
Definition as_val.h:42
@ AS_GEOJSON
Definition as_val.h:47
@ AS_BYTES
Definition as_val.h:45
@ AS_LIST
Definition as_val.h:41
AS_EXTERN as_bin_value * as_record_get(const as_record *rec, const char *name)

Traversing Bins

If you want to traverse the bins of a record, then you have two options:

Definition at line 166 of file as_record.h.

#include "as_record.h"

+ Inheritance diagram for as_record:
+ Collaboration diagram for as_record:

Data Fields

as_bins bins
 
uint16_t gen
 
as_key key
 
uint32_t ttl
 
- Data Fields inherited from as_rec
void * data
 
const struct as_rec_hooks_s * hooks
 
- Data Fields inherited from as_val
uint32_t count
 
bool free
 
as_val_t type
 

Related Symbols

(Note that these are not member symbols.)

AS_EXTERN void as_record_destroy (as_record *rec)
 
AS_EXTERN bool as_record_foreach (const as_record *rec, as_rec_foreach_callback callback, void *udata)
 
static as_recordas_record_fromval (const as_val *v)
 
AS_EXTERN as_bin_valueas_record_get (const as_record *rec, const char *name)
 
AS_EXTERN as_doubleas_record_get_as_double (const as_record *rec, const char *name)
 
AS_EXTERN bool as_record_get_bool (const as_record *rec, const char *name)
 
AS_EXTERN as_bytesas_record_get_bytes (const as_record *rec, const char *name)
 
AS_EXTERN double as_record_get_double (const as_record *rec, const char *name, double fallback)
 
AS_EXTERN as_geojsonas_record_get_geojson (const as_record *rec, const char *name)
 
AS_EXTERN char * as_record_get_geojson_str (const as_record *rec, const char *name)
 
AS_EXTERN int64_t as_record_get_int64 (const as_record *rec, const char *name, int64_t fallback)
 
AS_EXTERN as_integeras_record_get_integer (const as_record *rec, const char *name)
 
AS_EXTERN as_listas_record_get_list (const as_record *rec, const char *name)
 
AS_EXTERN as_mapas_record_get_map (const as_record *rec, const char *name)
 
AS_EXTERN char * as_record_get_str (const as_record *rec, const char *name)
 
AS_EXTERN as_stringas_record_get_string (const as_record *rec, const char *name)
 
AS_EXTERN char * as_record_get_udf_error (const as_record *rec)
 
AS_EXTERN as_valas_record_get_udf_result (const as_record *rec)
 
AS_EXTERN as_recordas_record_init (as_record *rec, uint16_t nbins)
 
#define as_record_inita(__rec, __nbins)
 
AS_EXTERN as_recordas_record_new (uint16_t nbins)
 
AS_EXTERN uint16_t as_record_numbins (const as_record *rec)
 
AS_EXTERN bool as_record_set (as_record *rec, const char *name, as_bin_value *value)
 
AS_EXTERN bool as_record_set_as_double (as_record *rec, const char *name, as_double *value)
 
AS_EXTERN bool as_record_set_bool (as_record *rec, const char *name, bool value)
 
AS_EXTERN bool as_record_set_bytes (as_record *rec, const char *name, as_bytes *value)
 
AS_EXTERN bool as_record_set_double (as_record *rec, const char *name, double value)
 
AS_EXTERN bool as_record_set_geojson (as_record *rec, const char *name, as_geojson *value)
 
static bool as_record_set_geojson_str (as_record *rec, const char *name, const char *value)
 
AS_EXTERN bool as_record_set_geojson_strp (as_record *rec, const char *name, const char *value, bool free)
 
AS_EXTERN bool as_record_set_int64 (as_record *rec, const char *name, int64_t value)
 
AS_EXTERN bool as_record_set_integer (as_record *rec, const char *name, as_integer *value)
 
AS_EXTERN bool as_record_set_list (as_record *rec, const char *name, as_list *value)
 
AS_EXTERN bool as_record_set_map (as_record *rec, const char *name, as_map *value)
 
AS_EXTERN bool as_record_set_nil (as_record *rec, const char *name)
 
static bool as_record_set_raw (as_record *rec, const char *name, const uint8_t *value, uint32_t size)
 
AS_EXTERN bool as_record_set_raw_typep (as_record *rec, const char *name, const uint8_t *value, uint32_t size, as_bytes_type type, bool free)
 
AS_EXTERN bool as_record_set_rawp (as_record *rec, const char *name, const uint8_t *value, uint32_t size, bool free)
 
static bool as_record_set_str (as_record *rec, const char *name, const char *value)
 
AS_EXTERN bool as_record_set_string (as_record *rec, const char *name, as_string *value)
 
AS_EXTERN bool as_record_set_strp (as_record *rec, const char *name, const char *value, bool free)
 
static as_valas_record_toval (const as_record *rec)
 

Friends And Related Symbol Documentation

◆ as_record_destroy()

AS_EXTERN void as_record_destroy ( as_record * rec)
related

Destroy the as_record and associated resources.

Parameters
recThe record to destroy.

◆ as_record_foreach()

AS_EXTERN bool as_record_foreach ( const as_record * rec,
as_rec_foreach_callback callback,
void * udata )
related

Iterate over each bin in the record and invoke the callback function.

bool print_bin(const char* name, const as_val * value, void* udata) {
char * sval = as_val_tostring(value);
printf("bin: name=%s, value=%s\n", name, sval);
free(sval);
return true;
}
as_record_foreach(rec, print_bin, NULL);
#define as_val_tostring(__v)
Definition as_val.h:132
AS_EXTERN bool as_record_foreach(const as_record *rec, as_rec_foreach_callback callback, void *udata)
bool free
Definition as_val.h:79

If the callback returns true, then iteration will continue to the next bin. Otherwise, the iteration will halt and as_record_foreach() will return false.

Parameters
recThe record containing the bins to iterate over.
callbackThe callback to invoke for each bin.
udataUser-data provided for the callback.
Returns
true if iteration completes fully. false if iteration was aborted.

◆ as_record_fromval()

static as_record * as_record_fromval ( const as_val * v)
related

Convert from an as_val.

Definition at line 1000 of file as_record.h.

References AS_REC, and as_util_fromval.

◆ as_record_get()

AS_EXTERN as_bin_value * as_record_get ( const as_record * rec,
const char * name )
related

Get specified bin's value.

as_val * value = as_record_get(rec, "bin");
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_as_double()

AS_EXTERN as_double * as_record_get_as_double ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_double.

as_double * value = as_record_get_as_double(rec, "bin");
AS_EXTERN as_double * as_record_get_as_double(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_bool()

AS_EXTERN bool as_record_get_bool ( const as_record * rec,
const char * name )
related

Get specified bin's value as a bool.

bool value = as_record_get_bool(rec, "bin");
AS_EXTERN bool as_record_get_bool(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise false.

◆ as_record_get_bytes()

AS_EXTERN as_bytes * as_record_get_bytes ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_bytes.

as_bytes * value = as_record_get_bytes(rec, "bin");
AS_EXTERN as_bytes * as_record_get_bytes(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_double()

AS_EXTERN double as_record_get_double ( const as_record * rec,
const char * name,
double fallback )
related

Get specified bin's value as a double.

double value = as_record_get_double(rec, "bin", -1.0);
AS_EXTERN double as_record_get_double(const as_record *rec, const char *name, double fallback)
Parameters
recThe record containing the bin.
nameThe name of the bin.
fallbackThe default value to use, if the bin doesn't exist or is not an integer.
Returns
the value if it exists, otherwise 0.

◆ as_record_get_geojson()

AS_EXTERN as_geojson * as_record_get_geojson ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_geojson.

as_geojson * value = as_record_get_geojson(rec, "bin");
AS_EXTERN as_geojson * as_record_get_geojson(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_geojson_str()

AS_EXTERN char * as_record_get_geojson_str ( const as_record * rec,
const char * name )
related

Get specified bin's value as an NULL terminated GeoJSON string.

char* value = as_record_get_geojson_str(rec, "bin");
AS_EXTERN char * as_record_get_geojson_str(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_int64()

AS_EXTERN int64_t as_record_get_int64 ( const as_record * rec,
const char * name,
int64_t fallback )
related

Get specified bin's value as an int64_t.

int64_t value = as_record_get_int64(rec, "bin", INT64_MAX);
AS_EXTERN int64_t as_record_get_int64(const as_record *rec, const char *name, int64_t fallback)
Parameters
recThe record containing the bin.
nameThe name of the bin.
fallbackThe default value to use, if the bin doesn't exist or is not an integer.
Returns
the value if it exists, otherwise 0.

◆ as_record_get_integer()

AS_EXTERN as_integer * as_record_get_integer ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_integer.

as_integer * value = as_record_get_integer(rec, "bin");
AS_EXTERN as_integer * as_record_get_integer(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_list()

AS_EXTERN as_list * as_record_get_list ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_list.

as_list * value = as_record_get_list(rec, "bin");
AS_EXTERN as_list * as_record_get_list(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_map()

AS_EXTERN as_map * as_record_get_map ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_map.

as_map * value = as_record_get_map(rec, "bin");
AS_EXTERN as_map * as_record_get_map(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_str()

AS_EXTERN char * as_record_get_str ( const as_record * rec,
const char * name )
related

Get specified bin's value as an NULL terminated string.

char* value = as_record_get_str(rec, "bin");
AS_EXTERN char * as_record_get_str(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_string()

AS_EXTERN as_string * as_record_get_string ( const as_record * rec,
const char * name )
related

Get specified bin's value as an as_string.

as_string * value = as_record_get_string(rec, "bin");
AS_EXTERN as_string * as_record_get_string(const as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
the value if it exists, otherwise NULL.

◆ as_record_get_udf_error()

AS_EXTERN char * as_record_get_udf_error ( const as_record * rec)
related

Get the error string returned by a UDF apply in a batch. Return null if an error did not occur.

◆ as_record_get_udf_result()

AS_EXTERN as_val * as_record_get_udf_result ( const as_record * rec)
related

Get the value returned by a UDF apply in a batch. The result may be null.

◆ as_record_init()

AS_EXTERN as_record * as_record_init ( as_record * rec,
uint16_t nbins )
related

Initializes an as_record created on the stack.

as_record_set_int64(&r, "bin1", 123);
as_record_set_str(&r, "bin1", "abc");
AS_EXTERN bool as_record_set_int64(as_record *rec, const char *name, int64_t value)
static bool as_record_set_str(as_record *rec, const char *name, const char *value)
Definition as_record.h:433

When you are finished using the as_record instance, you should release the resources allocated to it by calling as_record_destroy().

Parameters
recThe record to initialize.
nbinsThe number of bins to initialize.
Returns
a pointer to the initialized as_record if successful, otherwise NULL.

◆ as_record_inita

#define as_record_inita ( __rec,
__nbins )
related
Value:
as_record_init(__rec, 0);\
(__rec)->bins._free = false;\
(__rec)->bins.capacity = (__nbins);\
(__rec)->bins.size = 0;\
(__rec)->bins.entries = (as_bin*) alloca(sizeof(as_bin) * (__nbins));
uint16_t size
Definition as_bin.h:118
as_bin * entries
Definition as_bin.h:108
uint16_t capacity
Definition as_bin.h:113
as_bins bins
Definition as_record.h:203

Initialize a stack allocated as_record then allocate __nbins capacity for as_record.bins on the stack.

as_record record;
as_record_inita(&record, 2);
as_record_set_int64(&record, "bin1", 123);
as_record_set_int64(&record, "bin2", 456);

When you are finished using the as_record instance, you should release the resources allocated to it by calling as_record_destroy().

Parameters
__recThe as_record * to initialize.
__nbinsThe number of as_record.bins.entries to allocate on the stack.

Definition at line 254 of file as_record.h.

◆ as_record_new()

AS_EXTERN as_record * as_record_new ( uint16_t nbins)
related

Create a new as_record on the heap.

as_record_set_int64(r, "bin1", 123);
as_record_set_str(r, "bin1", "abc");

When you are finished using the as_record instance, you should release the resources allocated to it by calling as_record_destroy().

Parameters
nbinsThe number of bins to initialize.
Returns
a pointer to the new as_record if successful, otherwise NULL.

◆ as_record_numbins()

AS_EXTERN uint16_t as_record_numbins ( const as_record * rec)
related

Get the number of bins in the record.

Returns
the number of bins in the record.

◆ as_record_set()

AS_EXTERN bool as_record_set ( as_record * rec,
const char * name,
as_bin_value * value )
related

Set specified bin's value to an as_bin_value.

Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
true on success, false on failure.

◆ as_record_set_as_double()

AS_EXTERN bool as_record_set_as_double ( as_record * rec,
const char * name,
as_double * value )
related

Set specified bin's value to an as_double.

as_record_set_as_double(rec, "bin", as_double_new(123.456));
AS_EXTERN as_double * as_double_new(double value)
AS_EXTERN bool as_record_set_as_double(as_record *rec, const char *name, as_double *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_bool()

AS_EXTERN bool as_record_set_bool ( as_record * rec,
const char * name,
bool value )
related

Set specified bin's value to a bool. Requires server version 5.6.0+.

as_record_set_bool(rec, "bin", true);
AS_EXTERN bool as_record_set_bool(as_record *rec, const char *name, bool value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
true on success, false on failure.

◆ as_record_set_bytes()

AS_EXTERN bool as_record_set_bytes ( as_record * rec,
const char * name,
as_bytes * value )
related

Set specified bin's value to an as_bytes.

as_record_set_integer(rec, "bin", bytes);
AS_EXTERN bool as_record_set_integer(as_record *rec, const char *name, as_integer *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_double()

AS_EXTERN bool as_record_set_double ( as_record * rec,
const char * name,
double value )
related

Set specified bin's value to a double.

as_record_set_double(rec, "bin", 123.456);
AS_EXTERN bool as_record_set_double(as_record *rec, const char *name, double value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
true on success, false on failure.

◆ as_record_set_geojson()

AS_EXTERN bool as_record_set_geojson ( as_record * rec,
const char * name,
as_geojson * value )
related

Set specified bin's value to an as_geojson.

as_record_set_geojson(rec, "bin", as_geojson_new("abc", false));
AS_EXTERN as_geojson * as_geojson_new(char *value, bool free)
AS_EXTERN bool as_record_set_geojson(as_record *rec, const char *name, as_geojson *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_geojson_str()

static bool as_record_set_geojson_str ( as_record * rec,
const char * name,
const char * value )
related

Set specified bin's value to an NULL terminated GeoJSON string.

as_record_set_geojson_str(rec, "bin", "abc");
static bool as_record_set_geojson_str(as_record *rec, const char *name, const char *value)
Definition as_record.h:473
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

Definition at line 473 of file as_record.h.

◆ as_record_set_geojson_strp()

AS_EXTERN bool as_record_set_geojson_strp ( as_record * rec,
const char * name,
const char * value,
bool free )
related

Set specified bin's value to an NULL terminated GeoJSON string.

as_record_set_geojson_strp(rec, "bin", strdup("abc"), true);
AS_EXTERN bool as_record_set_geojson_strp(as_record *rec, const char *name, const char *value, bool free)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
freeIf true, then the value will be freed when the record is destroyed.
Returns
true on success, false on failure.

◆ as_record_set_int64()

AS_EXTERN bool as_record_set_int64 ( as_record * rec,
const char * name,
int64_t value )
related

Set specified bin's value to an int64_t.

as_record_set_int64(rec, "bin", 123);
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
true on success, false on failure.

◆ as_record_set_integer()

AS_EXTERN bool as_record_set_integer ( as_record * rec,
const char * name,
as_integer * value )
related

Set specified bin's value to an as_integer.

AS_EXTERN as_integer * as_integer_new(int64_t value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_list()

AS_EXTERN bool as_record_set_list ( as_record * rec,
const char * name,
as_list * value )
related

Set specified bin's value to an as_list.

as_arraylist_add_int64(&list, 1);
as_arraylist_add_int64(&list, 2);
as_arraylist_add_int64(&list, 3);
as_record_set_list(rec, "bin", &list);
AS_EXTERN as_arraylist * as_arraylist_init(as_arraylist *list, uint32_t capacity, uint32_t block_size)
AS_EXTERN bool as_record_set_list(as_record *rec, const char *name, as_list *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_map()

AS_EXTERN bool as_record_set_map ( as_record * rec,
const char * name,
as_map * value )
related

Set specified bin's value to an as_map.

as_hashmap_init(&map, 32);
as_stringmap_set_int64(&map, "a", 1);
as_stringmap_set_int64(&map, "b", 2);
as_stringmap_set_int64(&map, "c", 3);
as_record_set_map(rec, "bin", &map);
static as_hashmap * as_hashmap_init(as_hashmap *map, uint32_t capacity)
Definition as_hashmap.h:48
#define as_hashmap
Definition as_hashmap.h:41
static int as_stringmap_set_int64(as_map *m, const char *k, int64_t v)
AS_EXTERN bool as_record_set_map(as_record *rec, const char *name, as_map *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_nil()

AS_EXTERN bool as_record_set_nil ( as_record * rec,
const char * name )
related

Set specified bin's value to as_nil.

as_record_set_nil(rec, "bin");
AS_EXTERN bool as_record_set_nil(as_record *rec, const char *name)
Parameters
recThe record containing the bin.
nameThe name of the bin.
Returns
true on success, false on failure.

◆ as_record_set_raw()

static bool as_record_set_raw ( as_record * rec,
const char * name,
const uint8_t * value,
uint32_t size )
related

Set specified bin's value to an NULL terminated string.

uint8_t bytes[3] = {1,2,3};
as_record_set_raw(rec, "bin", bytes, 3);
static bool as_record_set_raw(as_record *rec, const char *name, const uint8_t *value, uint32_t size)
Definition as_record.h:547
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
sizeThe size of the value.
Returns
true on success, false on failure.

Definition at line 547 of file as_record.h.

◆ as_record_set_raw_typep()

AS_EXTERN bool as_record_set_raw_typep ( as_record * rec,
const char * name,
const uint8_t * value,
uint32_t size,
as_bytes_type type,
bool free )
related

Set specified bin's value to an as_bytes value of a specified type.

uint8_t * bytes = (uint8_t *) malloc(3);
bytes[0] = 1;
bytes[1] = 2;
bytes[3] = 3;
as_record_set_raw(rec, "bin", bytes, 3, true);
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
sizeThe size of the value.
typeThe as_bytes_type designation (AS_BYTES_*)
freeIf true, then the value will be freed when the record is destroyed.
Returns
true on success, false on failure.

◆ as_record_set_rawp()

AS_EXTERN bool as_record_set_rawp ( as_record * rec,
const char * name,
const uint8_t * value,
uint32_t size,
bool free )
related

Set specified bin's value to an NULL terminated string.

uint8_t * bytes = (uint8_t *) malloc(3);
bytes[0] = 1;
bytes[1] = 2;
bytes[3] = 3;
as_record_set_raw(rec, "bin", bytes, 3, true);
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
sizeThe size of the value.
freeIf true, then the value will be freed when the record is destroyed.
Returns
true on success, false on failure.

◆ as_record_set_str()

static bool as_record_set_str ( as_record * rec,
const char * name,
const char * value )
related

Set specified bin's value to an NULL terminated string.

as_record_set_str(rec, "bin", "abc");
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

Definition at line 433 of file as_record.h.

◆ as_record_set_string()

AS_EXTERN bool as_record_set_string ( as_record * rec,
const char * name,
as_string * value )
related

Set specified bin's value to an as_string.

as_record_set_string(rec, "bin", as_string_new("abc", false));
AS_EXTERN as_string * as_string_new(char *value, bool free)
AS_EXTERN bool as_record_set_string(as_record *rec, const char *name, as_string *value)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
Returns
true on success, false on failure.

◆ as_record_set_strp()

AS_EXTERN bool as_record_set_strp ( as_record * rec,
const char * name,
const char * value,
bool free )
related

Set specified bin's value to an NULL terminated string.

as_record_set_strp(rec, "bin", strdup("abc"), true);
AS_EXTERN bool as_record_set_strp(as_record *rec, const char *name, const char *value, bool free)
Parameters
recThe record containing the bin.
nameThe name of the bin.
valueThe value of the bin. Must be in scope for the lifetime of the record.
freeIf true, then the value will be freed when the record is destroyed.
Returns
true on success, false on failure.

◆ as_record_toval()

static as_val * as_record_toval ( const as_record * rec)
related

Convert to an as_val.

Definition at line 990 of file as_record.h.

Field Documentation

◆ bins

as_bins as_record::bins

The bins of the record.

Definition at line 203 of file as_record.h.

◆ gen

uint16_t as_record::gen

The generation of the record.

Definition at line 185 of file as_record.h.

◆ key

as_key as_record::key

The key of the record. This is only populated on records returned from a scan or secondary index query. This should not be set by the user.

Definition at line 180 of file as_record.h.

◆ ttl

uint32_t as_record::ttl

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

There are also special values that can be set in the record ttl:

  • AS_RECORD_DEFAULT_TTL: Use the server default ttl from the namespace.
  • AS_RECORD_NO_EXPIRE_TTL: Do not expire the record.
  • AS_RECORD_NO_CHANGE_TTL: Keep the existing record ttl when the record is updated.
  • AS_RECORD_CLIENT_DEFAULT_TTL: Use the default client ttl in as_policy_write.

Definition at line 198 of file as_record.h.


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