51 const int flags = TDB_NOLOCK | TDB_INCOMPATIBLE_HASH | TDB_NOSYNC;
52 const int hash_size = 33533;
54 struct tdb_context *db = tdb_open(path, hash_size, flags,
55 (create ? O_CREAT : 0) | O_RDWR, 00600);
70 TDB_CONTEXT *db = store;
74 dkey.dptr = (
unsigned char *) key;
76 data = tdb_fetch(db, dkey);
94 void *value,
size_t vlen)
100 TDB_CONTEXT *db = store;
104 dkey.dptr = (
unsigned char *) key;
107 databuf.dsize = vlen;
108 databuf.dptr = value;
110 return tdb_store(db, dkey, databuf, TDB_INSERT);
122 TDB_CONTEXT *db = store;
125 dkey.dptr = (
unsigned char *) key;
128 return tdb_delete(db, dkey);
140 TDB_CONTEXT *db = *ptr;
static void store_tdb_close(StoreHandle **ptr)
Close a Store connection - Implements StoreOps::close() -.
static int store_tdb_delete_record(StoreHandle *store, const char *key, size_t klen)
Delete a record from the Store - Implements StoreOps::delete_record() -.
static void * store_tdb_fetch(StoreHandle *store, const char *key, size_t klen, size_t *vlen)
Fetch a Value from the Store - Implements StoreOps::fetch() -.
static void store_tdb_free(StoreHandle *store, void **ptr)
Free a Value returned by fetch() - Implements StoreOps::free() -.
static StoreHandle * store_tdb_open(const char *path, bool create)
Open a connection to a Store - Implements StoreOps::open() -.
static int store_tdb_store(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen)
Write a Value to the Store - Implements StoreOps::store() -.
static const char * store_tdb_version(void)
Get a Store version string - Implements StoreOps::version() -.
Convenience wrapper for the library headers.
void StoreHandle
Opaque type for store backend.
#define STORE_BACKEND_OPS(_name)