fsqlite-core
Core database engine for FrankenSQLite. Provides the Connection API that ties
together parsing, planning, codegen, VDBE execution, schema management, and the
storage stack (pager, WAL, B-tree, MVCC, VFS).
Overview
fsqlite-core is the integration hub of the FrankenSQLite workspace. It owns
the Connection struct -- the primary entry point for opening databases,
preparing statements, executing queries, and managing transactions. Internally,
a query flows through:
- Parsing (
fsqlite-parser) -- SQL text to AST. - Planning (
fsqlite-planner) -- name resolution, projection expansion, index selection, codegen to VDBE bytecode. - Execution (
fsqlite-vdbe) -- bytecode interpretation with register file, cursors, and result row collection. - Storage -- pager, WAL, B-tree cursors, and MVCC concurrency control.
Beyond query execution, fsqlite-core also provides:
- Schema management -- CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE INDEX, CREATE VIEW, and PRAGMA handling.
- Transactions -- BEGIN, COMMIT, ROLLBACK, SAVEPOINT, RELEASE.
- MVCC -- concurrent writers with SSI (Serializable Snapshot Isolation), conflict detection, and garbage collection.
- Bounded parallelism -- bulkhead framework for internal background work
with configurable concurrency limits and
SQLITE_BUSYoverflow rejection. - Replication -- ECS replication sender/receiver, snapshot shipping, and RaptorQ-based forward error correction for WAL frames.
- EXPLAIN -- query plan explanation output.
- Observability -- metrics, tracing spans, and decision audit trails.
Position in the dependency graph:
fsqlite-core (this crate) -- the integration layer
--> fsqlite-parser (SQL parsing)
--> fsqlite-planner (query planning + codegen)
--> fsqlite-vdbe (bytecode execution)
--> fsqlite-btree (B-tree cursors)
--> fsqlite-pager (page cache)
--> fsqlite-wal (write-ahead log)
--> fsqlite-mvcc (concurrency control)
--> fsqlite-vfs (file system abstraction)
--> fsqlite-func (built-in SQL functions)
--> fsqlite-ext-json, fsqlite-ext-fts5 (extensions)
--> fsqlite-observability (metrics + tracing)
fsqlite-core is consumed by the public facade crate fsqlite, which
re-exports Connection, Row, and PreparedStatement.
Key Types
Connection-- Database connection. Open withConnection::open(path). Supports:memory:and file-backed databases. Holds the in-memory table store, pager backend, schema catalog, function registry, and transaction state.PreparedStatement-- A compiled SQL statement bound to a connection. Callquery(),query_with_params(),execute(), orquery_row().Row-- A single result row. Access column values viavalues().BulkheadConfig-- Bounded parallelism configuration (max concurrency, queue depth, overflow policy).OverflowPolicy-- What to do when the bulkhead is full (DropBusy).ParallelismProfile-- Runtime profile for parallelism defaults (Balanced).
Usage
use ;
// Open an in-memory database
let conn = open.expect;
// DDL
conn.execute?;
// DML
conn.execute?;
conn.execute?;
// Query
let rows: = conn.query?;
for row in &rows
// Prepared statement with parameters
let stmt = conn.prepare?;
let row = stmt.query_row_with_params?;
License
MIT (with OpenAI/Anthropic Rider) -- see workspace root LICENSE file.