19#ifndef PROTOCORE_DOCSTORE_H
20#define PROTOCORE_DOCSTORE_H
24#if PROTOCORE_ENABLE_DOCSTORE
33 struct protocore_dbm *db;
37void protocore_docstore_open(protocore_doc_store *ds,
struct protocore_dbm *db);
43proto_bool protocore_docstore_put(protocore_doc_store *ds,
const char *
id, uint16_t id_len,
const uint8_t *json,
50long protocore_docstore_get(protocore_doc_store *ds,
const char *
id, uint16_t id_len, uint8_t *buf,
size_t cap);
53proto_bool protocore_docstore_del(protocore_doc_store *ds,
const char *
id, uint16_t id_len);
56proto_bool protocore_docstore_contains(
const protocore_doc_store *ds,
const char *
id, uint16_t id_len);
59uint32_t protocore_docstore_count(
const protocore_doc_store *ds);
62proto_bool protocore_docstore_sync(protocore_doc_store *ds);
68typedef proto_bool (*protocore_doc_match_cb)(
const char *id, uint16_t id_len,
const uint8_t *json, uint32_t json_len,
75uint32_t protocore_docstore_find_str(protocore_doc_store *ds,
const char *field,
const char *value,
76 protocore_doc_match_cb cb,
void *ctx);
79uint32_t protocore_docstore_find_int(protocore_doc_store *ds,
const char *field,
long value, protocore_doc_match_cb cb,
83uint32_t protocore_docstore_find_bool(protocore_doc_store *ds,
const char *field,
proto_bool value,
84 protocore_doc_match_cb cb,
void *ctx);
Log-structured hash key-value store on the WAL (PROTOCORE_ENABLE_DBM, requires PROTOCORE_ENABLE_WAL).
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS