upscaledb  2.2.1
Data Fields
ups_record_t Struct Reference

#include <upscaledb.h>

Data Fields

uint32_t size
void * data
uint32_t flags

Detailed Description

A generic record.

A record represents data items in upscaledb. Before using a record, it is important to initialize all record fields with zeroes, i.e. with the C library routines memset(3) or bzero(2).

When upscaledb returns a record structure, the pointer to the record data is provided in data. This pointer is only temporary and will be overwritten by subsequent upscaledb API calls using the same Txn (or, if Transactions are disabled, using the same Database). The pointer will also be invalidated after the Txn is aborted or committed.

To avoid this, the calling application can allocate the data pointer. In this case, you have to set the flag UPS_RECORD_USER_ALLOC. The size parameter will then return the size of the record. It's the responsibility of the caller to make sure that the data parameter is large enough for the record.

The record->data pointer is not threadsafe. For threadsafe access it is recommended to use UPS_RECORD_USER_ALLOC or have each thread manage its own Txn.

Definition at line 202 of file upscaledb.h.

Field Documentation

void* ups_record_t::data

Pointer to the record data

Definition at line 207 of file upscaledb.h.

Referenced by main().

uint32_t ups_record_t::flags

The record flags; see UPS_RECORD_USER_ALLOC

Definition at line 210 of file upscaledb.h.

uint32_t ups_record_t::size

The size of the record data, in bytes

Definition at line 204 of file upscaledb.h.

Referenced by main().

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