Skip to main content

Module qengine

Module qengine 

Source
Expand description

The query engine (qengine/DESIGN.md): a from-scratch incremental, memoized evaluator, a faithful port of decl-ts/src/qengine. db is the generic incremental core; qeval drives the shared programs and retained slot graph.

Modules§

db
The incremental, memoized query core of the query engine (qengine/DESIGN.md); the faithful port of decl-ts/src/qengine/db.ts. A demand-driven database of queries. Some keys are inputs (set from outside); the rest are derived — computed by a resolver-supplied function that reads other queries through the database, so its dependencies are recorded automatically. Results are memoized with a global revision and two stamps per entry, giving early cutoff on both axes. The verify cutoff: if none of an entry’s dependencies changed since it was verified, it is reused without recomputing. The value cutoff: a recompute that yields an equal value does not advance the entry’s changed-revision, so its dependents cut off in turn. This is Salsa/Adapton-shaped, generic over the value it stores, and independent of the decl language; the decl layer (compiled expressions as derived queries) is built on top.
edits
Replay Session root binding over retained records and member revisions.
programs
Executable expressions shared by syntax identity. Operations receive their engine and lexical frame at execution time; none capture a record instance.
qeval
Query entry points using shared programs and the value layer’s slot graph.
revisions
Revision verification over the Engine’s existing slot cache. Previous values live here only while a slot awaits verification or recomputation.
rounds
Reference-round reuse over the value layer; mirrors qengine/rounds.ts.