Expand description
In-memory document engine providing collection CRUD, secondary indexes, and WHERE-clause query execution.
DocEngine is the top-level entry point. It owns an IdRegistry,
a map of per-collection state (metadata, dictionary, packed documents,
and indexes), and orchestrates the full document lifecycle:
§Write Path
- The caller supplies a JSON
ValuetoDocEngine::set. - The engine resolves (or allocates) a
DocIdvia the registry. - Unique-constraint indexes are checked before mutation.
- If the document already exists, old index entries are removed.
- The JSON is decomposed into a
PackedDocthrough theDecomposerpipeline. - New index entries are inserted for every configured field.
§Read Path
DocEngine::getretrieves and recomposes a single document, with optional field-level projection.DocEngine::findparses a WHERE expression viaparse_where, walks the AST to collect candidateDocIdsets (using indexes when available, falling back to a full collection scan), applies pagination, and recomposes results.
§Index Maintenance
DocEngine::create_index registers a secondary index and backfills
every existing document. Four index types are supported: Hash, Sorted,
Array, and Unique. Index entries are maintained automatically on
set, update, and del.
§Mutation
DocEngine::update applies a sequence of DocMutation operations
(Set, Del, Incr, Push, Pull) to an existing document’s JSON
representation, then round-trips through set so indexes and packed
storage stay consistent.
Structs§
- Collection
Info - Snapshot of collection metadata and current storage counters.
- Dictionary
Field Info - Cardinality details for one collection field.
- Dictionary
Info - Snapshot of collection dictionary statistics.
- DocEngine
- Document engine with collection-local dictionaries and packed docs.
- Insert
Result - Result of a
DocEngine::insertcall with an auto-generated ID. - SetResult
- Result of a successful
setoperation. - Storage
Info - Snapshot of collection storage footprint.
Enums§
- DocError
- Errors returned by
DocEngine. - DocMutation
- Mutation operation used by
DocEngine::update.