upscaledb
2.2.1
|
#include <upscaledb.h>
Data Fields | |
uint16_t | size |
void * | data |
uint32_t | flags |
uint32_t | _flags |
A generic key.
A key represents key items in upscaledb. Before using a key, it is important to initialize all key fields with zeroes, i.e. with the C library routines memset(3) or bzero(2).
upscaledb usually uses keys to insert, delete or search for items. However, when using Database Cursors and the function ups_cursor_move, upscaledb also returns keys. In this case, the pointer to the key data is provided in data. This pointer is only temporary and will be overwritten by subsequent calls to ups_cursor_move 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_KEY_USER_ALLOC. The size parameter will then return the size of the key. It's the responsibility of the caller to make sure that the data parameter is large enough for the key.
The key->data pointer is not threadsafe. For threadsafe access it is recommended to use UPS_KEY_USER_ALLOC or have each thread manage its own Txn.
Definition at line 253 of file upscaledb.h.
uint32_t ups_key_t::_flags |
For internal use
Definition at line 264 of file upscaledb.h.
void* ups_key_t::data |
uint32_t ups_key_t::flags |
The key flags; see UPS_KEY_USER_ALLOC
Definition at line 261 of file upscaledb.h.
Referenced by main().
uint16_t ups_key_t::size |