47 const int pagesize = 4096;
49 GDBM_FILE db = gdbm_open((
char *) path, pagesize,
50 create ? GDBM_WRCREAT : GDBM_WRITER, 00600, NULL);
54 db = gdbm_open((
char *) path, pagesize, GDBM_READER, 00600, NULL);
66 if (!store || (klen > INT_MAX))
75 dkey.dptr = (
char *) key;
77 data = gdbm_fetch(db, dkey);
95 void *value,
size_t vlen)
97 if (!store || (klen > INT_MAX) || (vlen > INT_MAX))
101 datum databuf = { 0 };
104 GDBM_FILE db = store;
106 dkey.dptr = (
char *) key;
109 databuf.dsize = vlen;
110 databuf.dptr = value;
112 return gdbm_store(db, dkey, databuf, GDBM_REPLACE);
120 if (!store || (klen > INT_MAX))
126 GDBM_FILE db = store;
128 dkey.dptr = (
char *) key;
131 return gdbm_delete(db, dkey);
static void store_gdbm_close(StoreHandle **ptr)
Close a Store connection - Implements StoreOps::close() -.
static int store_gdbm_delete_record(StoreHandle *store, const char *key, size_t klen)
Delete a record from the Store - Implements StoreOps::delete_record() -.
static void * store_gdbm_fetch(StoreHandle *store, const char *key, size_t klen, size_t *vlen)
Fetch a Value from the Store - Implements StoreOps::fetch() -.
static void store_gdbm_free(StoreHandle *store, void **ptr)
Free a Value returned by fetch() - Implements StoreOps::free() -.
static StoreHandle * store_gdbm_open(const char *path, bool create)
Open a connection to a Store - Implements StoreOps::open() -.
static int store_gdbm_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_gdbm_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)