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 38 of file as_batch.h.

#include "as_batch.h"

+ Collaboration diagram for as_batch:

Data Fields

bool _free
 
struct {
   bool   _free
 
   as_key *   entries
 
   uint32_t   size
 
keys
 

Related Functions

(Note that these are not member functions.)

void as_batch_destroy (as_batch *batch)
 
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_batchas_batch_new (uint32_t size)
 

Friends And Related Function Documentation

void as_batch_destroy ( as_batch batch)
related

Destroy the batch of keys.

Parameters
batchThe batch to release.
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:
if ( (__batch) != NULL ) {\
(__batch)->_free = false;\
(__batch)->keys.entries = (as_key *) alloca(sizeof(as_key) * __size);\
if ( (__batch)->keys.entries ) { \
(__batch)->keys._free = false;\
(__batch)->keys.size = __size;\
}\
}

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 126 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 207 of file as_batch.h.

References entries, keys, and size.

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

bool as_batch::_free

If true, then this structure will be freed when as_batch_destroy() is called.

Definition at line 44 of file as_batch.h.

as_key* as_batch::entries

The keys contained by this batch.

Definition at line 65 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 60 of file as_batch.h.


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