Skip to main content

Module reader

Module reader 

Source
Expand description

Lock-free MVCC epoch readers.

Each reader snapshots the db state at a fold point (every FOLD_EVERY_K commits) plus a bounded delta tail, allowing concurrent reads without holding the write lock.

§Correctness guarantees

  1. Snapshot isolation: query returns results consistent with the db state at the moment [GraphDb::reader] was called.
  2. RBAC mask coherence (constraint 2): ReaderSnapshot::mask_for_role and ReaderSnapshot::query_masked operate on the same frozen base, so no node can slip through a stale mask.
  3. Delta chain bounded: at most FOLD_EVERY_K − 1 deltas in the tail (fold resets the counter synchronously on the write path).

Structs§

CommitDelta
Per-commit overlay change record. Immutable after creation.
FrozenOverlay
Full clone of overlay state captured at fold time.
ReaderSnapshot
Lock-free reader snapshot: frozen overlay + optional V8 base + pending delta tail.

Constants§

FOLD_EVERY_K
Fold trigger: every K commits, the overlay is cloned into a new FrozenOverlay and delta_tail is reset. The tail length is always ≤ K−1.