ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
docstore.h File Reference

Local JSON document store on the WAL (PC_ENABLE_DOCSTORE, requires DBM + WAL). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

Local JSON document store on the WAL (PC_ENABLE_DOCSTORE, requires DBM + WAL).

A small NoSQL document store: documents are JSON objects addressed by an id, kept durably on the write-ahead log. It is a thin layer over dbm (dbm.h) - the id is the key, the JSON body is the value - so it inherits dbm's zero-heap index, WAL persistence, and crash recovery for free. What it adds on top is the document capability: field queries - scan the live documents and match those whose top-level JSON field equals a value (like a small find({field: value})), using the zero-heap JSON reader (json.h). Values are bounded by PC_DBM_VAL_MAX, ids by PC_DBM_KEY_MAX.

Writes are batched; call ::pc_docstore_sync to checkpoint the WAL and make them durable. Drive it from one context (a worker / loop), not concurrently, and do not put/delete from inside a find callback.

Definition in file docstore.h.