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

Detailed Description

A collection of keys to be batch processed.

Definition at line 35 of file as_batch.h.

#include "as_batch.h"

+ Collaboration diagram for as_batch:

Data Fields

struct {
   as_key *   entries
 
   uint32_t   size
 
keys
 

Related Functions

(Note that these are not member functions.)

AS_EXTERN void as_batch_destroy (as_batch *batch)
 
AS_EXTERN as_batchas_batch_init (as_batch *batch, uint32_t size)
 
#define as_batch_inita(__batch, __size)
 
static as_keyas_batch_keyat (const as_batch *batch, uint32_t i)
 
AS_EXTERN as_batchas_batch_new (uint32_t size)
 

Friends And Related Function Documentation

AS_EXTERN void as_batch_destroy ( as_batch batch)
related

Destroy the batch of keys.

Parameters
batchThe batch to release.
AS_EXTERN as_batch * as_batch_init ( as_batch batch,
uint32_t  size 
)
related

Initialize a stack allocated as_batch capable of storing capacity keys.

as_batch batch;
as_batch_init(&batch, 2);
as_key_init(as_batch_get(&batch, 0), "ns", "set", "key1");
as_key_init(as_batch_get(&batch, 1), "ns", "set", "key2");

When the batch is no longer needed, then use as_batch_destroy() to release the batch and associated resources.

Parameters
batchThe batch to initialize.
sizeThe number of keys to allocate.
#define as_batch_inita (   __batch,
  __size 
)
related
Value:
do {\
(__batch)->keys.entries = (as_key*) alloca(sizeof(as_key) * (__size));\
if ((__batch)->keys.entries) { \
(__batch)->keys.size = (__size);\
(__batch)->keys._free = false;\
}\
(__batch)->_free = false;\
} while(0)

Initializes as_batch with specified capacity using alloca().

For heap allocation, use as_batch_new().

as_batch batch;
as_batch_inita(&batch, 2);
as_key_init(as_batch_get(&batch, 0), "ns", "set", "key1");
as_key_init(as_batch_get(&batch, 1), "ns", "set", "key2");

When the batch is no longer needed, then use as_batch_destroy() to release the batch and associated resources.

Parameters
__batchThe query to initialize.
__sizeThe number of keys to allocate.

Definition at line 128 of file as_batch.h.

static as_key * as_batch_keyat ( const as_batch batch,
uint32_t  i 
)
related

Get the key at given position of the batch. If the position is not within the allocated capacity for the batchm then NULL is returned.

Parameters
batchThe batch to get the key from.
iThe position of the key.
Returns
On success, the key at specified position. If position is invalid, then NULL.

Definition at line 213 of file as_batch.h.

References entries, keys, and size.

AS_EXTERN as_batch * as_batch_new ( uint32_t  size)
related

Create and initialize a heap allocated as_batch capable of storing capacity keys.

as_batch* batch = as_batch_new(2);
as_key_init(as_batch_get(batch, 0), "ns", "set", "key1");
as_key_init(as_batch_get(batch, 1), "ns", "set", "key2");

When the batch is no longer needed, then use as_batch_destroy() to release the batch and associated resources.

Parameters
sizeThe number of keys to allocate.

Field Documentation

as_key* as_batch::entries

The keys contained by this batch.

Definition at line 45 of file as_batch.h.

struct { ... } as_batch::keys

Sequence of keys in the batch.

uint32_t as_batch::size

The number of keys this structure contains.

Definition at line 50 of file as_batch.h.


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