Expand description
The server-side leaf [Source]: a Source backed by a SQLite table (the
server-side replica of Postgres). Production port of
packages/zqlite/src/table-source.ts (class TableSource), the peer of the
client-side MemorySource. It owns three things
(05 §1.1):
- The leaf scan — a
FetchRequestis compiled to a parameterizedSELECT(build_select_query) and executed againstrusqlite, vending rows lazily and zero-copy:Str/Jsonvalues borrow directly from thesqlite3_column_textbuffers (valid only until the next step), and a row is materialized exactly once — at the connection boundary — via the borrow checker-forced [RowRef::to_owned_row]. The whole conn→stmt→cursor borrow chain is owned by oneOwnedSqliteRowsso the lazy stream can be boxed and returned (the05§13 Q1 self-reference, solved with one contained, drop-orderedunsafe). - Connections + the overlay/push/edit-split machinery — identical to the
memory leaf: it reuses the backend-agnostic
source_commonseam verbatim (generate_with_overlay_checked, [generate_with_start],try_gen_push_and_write_with_split_edit). The leaf only differs in the scan. - The write path —
INSERT/DELETE/UPDATE, committed after the vend (the self-join correctness invariant, §3.11).
A source emits rows, not nodes (04/05 §1.1): fetch returns a
[RowFlow]; the connection boundary (Graph::fetch on a SourceConn) wraps
each row in a leaf node. The Node concept lives entirely above this module —
exactly as for MemorySource.
Build target: feature = "sqlite" only.
Structs§
- Table
Source TableSource— the SQLite-backed leaf source. MirrorsMemorySource’s shape: the overlay/push/edit-split machinery is shared; only the leaf scan (a realrusqlitecursor instead of a COW B+tree) and the write path differ.