All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Typedefs | Functions
as_rec.h File Reference
#include <aerospike/as_integer.h>
#include <aerospike/as_bytes.h>
#include <aerospike/as_geojson.h>
#include <aerospike/as_list.h>
#include <aerospike/as_map.h>
#include <aerospike/as_std.h>
#include <aerospike/as_string.h>
#include <aerospike/as_util.h>
#include <aerospike/as_val.h>
+ Include dependency graph for as_rec.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_rec
 
struct  as_rec_hooks
 

Typedefs

typedef void(* as_rec_bin_names_callback )(char *bin_names, uint32_t nbins, uint16_t max_name_size, void *udata)
 
typedef bool(* as_rec_foreach_callback )(const char *name, const as_val *value, void *udata)
 

Functions

static int as_rec_bin_names (const as_rec *rec, as_rec_bin_names_callback callback, void *udata)
 
AS_EXTERN as_recas_rec_cons (as_rec *rec, bool free, void *data, const as_rec_hooks *hooks)
 
static void as_rec_destroy (as_rec *rec)
 
static uint32_t as_rec_device_size (const as_rec *rec)
 
static as_bytesas_rec_digest (const as_rec *rec)
 
static int as_rec_drop_key (const as_rec *rec)
 
static bool as_rec_foreach (const as_rec *rec, as_rec_foreach_callback callback, void *udata)
 
static as_recas_rec_fromval (const as_val *v)
 
static uint16_t as_rec_gen (const as_rec *rec)
 
static as_valas_rec_get (const as_rec *rec, const char *name)
 
static as_doubleas_rec_get_as_double (const as_rec *rec, const char *name)
 
static as_bytesas_rec_get_bytes (const as_rec *rec, const char *name)
 
static double as_rec_get_double (const as_rec *rec, const char *name)
 
static as_geojsonas_rec_get_geojson (const as_rec *rec, const char *name)
 
static char * as_rec_get_geojson_str (const as_rec *rec, const char *name)
 
static int64_t as_rec_get_int64 (const as_rec *rec, const char *name)
 
static as_integeras_rec_get_integer (const as_rec *rec, const char *name)
 
static as_listas_rec_get_list (const as_rec *rec, const char *name)
 
static as_mapas_rec_get_map (const as_rec *rec, const char *name)
 
static char * as_rec_get_str (const as_rec *rec, const char *name)
 
static as_stringas_rec_get_string (const as_rec *rec, const char *name)
 
AS_EXTERN as_recas_rec_init (as_rec *rec, void *data, const as_rec_hooks *hooks)
 
static as_valas_rec_key (const as_rec *rec)
 
static uint64_t as_rec_last_update_time (const as_rec *rec)
 
static uint32_t as_rec_memory_size (const as_rec *rec)
 
AS_EXTERN as_recas_rec_new (void *data, const as_rec_hooks *hooks)
 
static uint16_t as_rec_numbins (const as_rec *rec)
 
static int as_rec_remove (const as_rec *rec, const char *name)
 
static int as_rec_set (const as_rec *rec, const char *name, const as_val *value)
 
static int as_rec_set_as_double (const as_rec *rec, const char *name, const as_double *value)
 
static int as_rec_set_bytes (const as_rec *rec, const char *name, const as_bytes *value)
 
static int as_rec_set_double (const as_rec *rec, const char *name, double value)
 
static int as_rec_set_geojson (const as_rec *rec, const char *name, const as_geojson *value)
 
static int as_rec_set_int64 (const as_rec *rec, const char *name, int64_t value)
 
static int as_rec_set_integer (const as_rec *rec, const char *name, const as_integer *value)
 
static int as_rec_set_list (const as_rec *rec, const char *name, const as_list *value)
 
static int as_rec_set_map (const as_rec *rec, const char *name, const as_map *value)
 
static int as_rec_set_str (const as_rec *rec, const char *name, const char *value)
 
static int as_rec_set_string (const as_rec *rec, const char *name, const as_string *value)
 
static int as_rec_set_ttl (const as_rec *rec, uint32_t ttl)
 
static const char * as_rec_setname (const as_rec *rec)
 
static uint32_t as_rec_size (const as_rec *rec)
 
static void * as_rec_source (const as_rec *rec)
 
static as_valas_rec_toval (const as_rec *rec)
 
static uint32_t as_rec_ttl (const as_rec *rec)
 
AS_EXTERN void as_rec_val_destroy (as_val *)
 
AS_EXTERN uint32_t as_rec_val_hashcode (const as_val *v)
 
AS_EXTERN char * as_rec_val_tostring (const as_val *v)
 

Typedef Documentation

typedef void(* as_rec_bin_names_callback)(char *bin_names, uint32_t nbins, uint16_t max_name_size, void *udata)

Callback function for as_rec_bin_names(). Used for porting bin names to Lua.

Parameters
bin_namesA string containing the (null-terminated) bin names.
nbinsThe number of bins in the record.
max_name_sizeThe maximum length of a bin name.
udataUser-provided data.

Definition at line 49 of file as_rec.h.

typedef bool(* as_rec_foreach_callback)(const char *name, const as_val *value, void *udata)

Callback function for as_rec_foreach(). Called for each bin in the record.

Parameters
nameThe name of the current bin.
valueThe value of the current bin.
udataThe user-data provided to the as_rec_foreach().
Returns
true to continue iterating through the list. false to stop iterating.

Definition at line 62 of file as_rec.h.

Function Documentation

static int as_rec_bin_names ( const as_rec rec,
as_rec_bin_names_callback  callback,
void *  udata 
)
inlinestatic

Get a list of the bin names in the record.

Definition at line 379 of file as_rec.h.

References as_util_hook.

AS_EXTERN as_rec * as_rec_cons ( as_rec rec,
bool  free,
void *  data,
const as_rec_hooks hooks 
)
private

Utilized by subtypes of as_rec to initialize the parent.

Parameters
recThe record to initialize
freeIf TRUE, then as_rec_destory() will free the record.
dataData for the map.
hooksImplementation for the map interface.
Returns
The initialized as_map on success. Otherwise NULL.
static void as_rec_destroy ( as_rec rec)
inlinestatic

Destroy the record.

Definition at line 249 of file as_rec.h.

References as_val_destroy.

static uint32_t as_rec_device_size ( const as_rec rec)
inlinestatic

Get the device storage size of the record - deprecated!

Definition at line 339 of file as_rec.h.

References as_util_hook.

static as_bytes * as_rec_digest ( const as_rec rec)
inlinestatic

Get the digest of the record.

Definition at line 389 of file as_rec.h.

References as_util_hook.

static int as_rec_drop_key ( const as_rec rec)
inlinestatic

Drop the record's key.

Definition at line 409 of file as_rec.h.

References as_util_hook.

static bool as_rec_foreach ( const as_rec rec,
as_rec_foreach_callback  callback,
void *  udata 
)
inlinestatic

Call the callback function for each bin in the record.

Parameters
recThe as_rec containing the bins to iterate over.
callbackThe function to call for each entry.
udataUser-data to be passed to the callback.
Returns
true if iteration completes fully. false if iteration was aborted.

Definition at line 808 of file as_rec.h.

References as_util_hook.

static as_rec * as_rec_fromval ( const as_val v)
inlinestatic

Convert from an as_val.

Definition at line 832 of file as_rec.h.

References AS_REC, and as_util_fromval.

static uint16_t as_rec_gen ( const as_rec rec)
inlinestatic

Get the generation of the record

Definition at line 309 of file as_rec.h.

References as_util_hook.

static as_val * as_rec_get ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 428 of file as_rec.h.

References as_util_hook.

static as_double * as_rec_get_as_double ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_double.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 527 of file as_rec.h.

References as_double::as_double_fromval(), and as_util_hook.

static as_bytes * as_rec_get_bytes ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_bytes.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 575 of file as_rec.h.

References as_bytes::as_bytes_fromval(), and as_util_hook.

static double as_rec_get_double ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as a double.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise 0.

Definition at line 460 of file as_rec.h.

References as_double::as_double_fromval(), as_util_hook, and as_double::value.

static as_geojson * as_rec_get_geojson ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_geojson.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 559 of file as_rec.h.

References as_geojson::as_geojson_fromval(), and as_util_hook.

static char * as_rec_get_geojson_str ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as a NULL terminated GeoJSON string.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 494 of file as_rec.h.

References as_geojson::as_geojson_fromval(), as_geojson::as_geojson_get(), and as_util_hook.

static int64_t as_rec_get_int64 ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an int64_t.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise 0.

Definition at line 443 of file as_rec.h.

References as_integer::as_integer_fromval(), as_integer::as_integer_toint(), and as_util_hook.

static as_integer * as_rec_get_integer ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_integer.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 511 of file as_rec.h.

References as_integer::as_integer_fromval(), and as_util_hook.

static as_list * as_rec_get_list ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_list.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 591 of file as_rec.h.

References as_list::as_list_fromval(), and as_util_hook.

static as_map * as_rec_get_map ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_map.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 607 of file as_rec.h.

References as_map::as_map_fromval(), and as_util_hook.

static char * as_rec_get_str ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as a NULL terminated string.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 477 of file as_rec.h.

References as_string::as_string_fromval(), as_string::as_string_tostring(), and as_util_hook.

static as_string * as_rec_get_string ( const as_rec rec,
const char *  name 
)
inlinestatic

Get a bin's value as an as_string.

Parameters
recThe as_rec to read the bin value from.
nameThe name of the bin.
Returns
On success, the value of the bin. Otherwise NULL.

Definition at line 543 of file as_rec.h.

References as_string::as_string_fromval(), and as_util_hook.

AS_EXTERN as_rec * as_rec_init ( as_rec rec,
void *  data,
const as_rec_hooks hooks 
)

Initialize a stack allocated record.

Parameters
recStack allocated record to initialize.
dataData for the record.
hooksImplementation for the record interface.
Returns
On success, the initialized record. Otherwise NULL.
static as_val * as_rec_key ( const as_rec rec)
inlinestatic

Get the record's key.

Definition at line 349 of file as_rec.h.

References as_util_hook.

static uint64_t as_rec_last_update_time ( const as_rec rec)
inlinestatic

Get the last update time for the record.

Definition at line 299 of file as_rec.h.

References as_util_hook.

static uint32_t as_rec_memory_size ( const as_rec rec)
inlinestatic

Get the memory storage size of the record - deprecated!

Definition at line 329 of file as_rec.h.

References as_util_hook.

AS_EXTERN as_rec * as_rec_new ( void *  data,
const as_rec_hooks hooks 
)

Create and initialize a new heap allocated record.

Parameters
dataData for the record.
hooksImplementation for the record interface.
Returns
On success, a new record. Otherwise NULL.
static uint16_t as_rec_numbins ( const as_rec rec)
inlinestatic

Get the number of bins in the record.

Definition at line 369 of file as_rec.h.

References as_util_hook.

static int as_rec_remove ( const as_rec rec,
const char *  name 
)
inlinestatic

Set bin value to nil. This will instruct the server to remove the bin when the record is written using aerospike_key_put().

Parameters
recThe record to remove the bin from.
nameThe name of the bin to remove.
Returns
0 on success, otherwise an error occurred.

Definition at line 279 of file as_rec.h.

References as_util_hook.

static int as_rec_set ( const as_rec rec,
const char *  name,
const as_val value 
)
inlinestatic

Set the bin's value to an as_val.

Parameters
recThe as_rec to write the bin value to - CONSUMES REFERENCE
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 628 of file as_rec.h.

References as_util_hook.

static int as_rec_set_as_double ( const as_rec rec,
const char *  name,
const as_double value 
)
inlinestatic

Set the bin's value to an as_double.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 708 of file as_rec.h.

References as_util_hook.

static int as_rec_set_bytes ( const as_rec rec,
const char *  name,
const as_bytes value 
)
inlinestatic

Set the bin's value to an as_bytes.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 756 of file as_rec.h.

References as_util_hook.

static int as_rec_set_double ( const as_rec rec,
const char *  name,
double  value 
)
inlinestatic

Set the bin's value to a double.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 660 of file as_rec.h.

References as_double::as_double_new(), and as_util_hook.

static int as_rec_set_geojson ( const as_rec rec,
const char *  name,
const as_geojson value 
)
inlinestatic

Set the bin's value to an as_geojson.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 740 of file as_rec.h.

References as_util_hook.

static int as_rec_set_int64 ( const as_rec rec,
const char *  name,
int64_t  value 
)
inlinestatic

Set the bin's value to an int64_t.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 644 of file as_rec.h.

References as_integer::as_integer_new(), and as_util_hook.

static int as_rec_set_integer ( const as_rec rec,
const char *  name,
const as_integer value 
)
inlinestatic

Set the bin's value to an as_integer.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 692 of file as_rec.h.

References as_util_hook.

static int as_rec_set_list ( const as_rec rec,
const char *  name,
const as_list value 
)
inlinestatic

Set the bin's value to an as_list.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 772 of file as_rec.h.

References as_util_hook.

static int as_rec_set_map ( const as_rec rec,
const char *  name,
const as_map value 
)
inlinestatic

Set the bin's value to an as_map.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 788 of file as_rec.h.

References as_util_hook.

static int as_rec_set_str ( const as_rec rec,
const char *  name,
const char *  value 
)
inlinestatic

Set the bin's value to a NULL terminated string.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 676 of file as_rec.h.

References as_string_new_strdup(), and as_util_hook.

static int as_rec_set_string ( const as_rec rec,
const char *  name,
const as_string value 
)
inlinestatic

Set the bin's value to an as_string.

Parameters
recThe as_rec storing the bin.
nameThe name of the bin.
valueThe value of the bin.
Returns
On success, 0. Otherwise an error occurred.

Definition at line 724 of file as_rec.h.

References as_util_hook.

static int as_rec_set_ttl ( const as_rec rec,
uint32_t  ttl 
)
inlinestatic

Set the time to live (ttl).

Definition at line 399 of file as_rec.h.

References as_util_hook.

static const char * as_rec_setname ( const as_rec rec)
inlinestatic

Get the record's set name.

Definition at line 359 of file as_rec.h.

References as_util_hook.

static uint32_t as_rec_size ( const as_rec rec)
inlinestatic

Get the stored size (bytes) of the record

Definition at line 319 of file as_rec.h.

References as_util_hook.

static void * as_rec_source ( const as_rec rec)
inlinestatic

Get the data source for the record.

Definition at line 263 of file as_rec.h.

References as_rec::data.

static as_val * as_rec_toval ( const as_rec rec)
inlinestatic

Convert to an as_val.

Definition at line 822 of file as_rec.h.

static uint32_t as_rec_ttl ( const as_rec rec)
inlinestatic

Get the ttl for the record.

Definition at line 289 of file as_rec.h.

References as_util_hook.

AS_EXTERN void as_rec_val_destroy ( as_val )
private

Internal helper function for destroying an as_val.

AS_EXTERN uint32_t as_rec_val_hashcode ( const as_val v)
private

Internal helper function for getting the hashcode of an as_val.

AS_EXTERN char* as_rec_val_tostring ( const as_val v)
private

Internal helper function for getting the string representation of an as_val.