DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
docstore.h File Reference

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

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Local JSON document store on the WAL (DETWS_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 DETWS_DBM_VAL_MAX, ids by DETWS_DBM_KEY_MAX.

Writes are batched; call ::detws_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.