52 buf_printf(kcdbpath,
"%s#type=kct#opts=l#rcomp=lex", path);
54 if (!kcdbopen(db,
buf_string(kcdbpath), KCOWRITER | (create ? KCOCREATE : 0)))
56 int ecode = kcdbecode(db);
72 size_t klen,
size_t *vlen)
79 return kcdbget(db, key, klen, vlen);
98 size_t klen,
void *value,
size_t vlen)
105 if (!kcdbset(db, key, klen, value, vlen))
107 int ecode = kcdbecode(db);
108 return ecode ? ecode : -1;
123 if (!kcdbremove(db, key, klen))
125 int ecode = kcdbecode(db);
126 return ecode ? ecode : -1;
143 int ecode = kcdbecode(db);
155 static char version_cache[128] = { 0 };
156 if (version_cache[0] ==
'\0')
157 snprintf(version_cache,
sizeof(version_cache),
"kyotocabinet %s", KCVERSION);
159 return version_cache;
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
#define mutt_debug(LEVEL,...)
static void store_kyotocabinet_close(StoreHandle **ptr)
Close a Store connection - Implements StoreOps::close() -.
static int store_kyotocabinet_delete_record(StoreHandle *store, const char *key, size_t klen)
Delete a record from the Store - Implements StoreOps::delete_record() -.
static void * store_kyotocabinet_fetch(StoreHandle *store, const char *key, size_t klen, size_t *vlen)
Fetch a Value from the Store - Implements StoreOps::fetch() -.
static void store_kyotocabinet_free(StoreHandle *store, void **ptr)
Free a Value returned by fetch() - Implements StoreOps::free() -.
static StoreHandle * store_kyotocabinet_open(const char *path, bool create)
Open a connection to a Store - Implements StoreOps::open() -.
static int store_kyotocabinet_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_kyotocabinet_version(void)
Get a Store version string - Implements StoreOps::version() -.
@ LL_DEBUG2
Log at debug level 2.
Convenience wrapper for the library headers.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
void StoreHandle
Opaque type for store backend.
#define STORE_BACKEND_OPS(_name)
String manipulation buffer.