Skip to main content

Module db

Module db 

Source
Expand description

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.

Structs§

Db
the incremental, memoized query database (see the module comment)

Enums§

DbErr
the failure a query may produce: a dependency cycle the core itself detects (§7.6/§9.3), or a failure raised by a compute (a value-layer error/taint)

Type Aliases§

Compute
compute a derived query’s value, reading other queries through the database
DResult
a query’s result: its value or a DbErr
Key
a query key — an opaque string; the decl layer defines the grammar of keys
Resolve
map a derived key to its compute; None for an unknown key