Skip to main content

Module pool

Module pool 

Source
Expand description

Canonical SQLite connection builder shared by every microsandbox process.

Both the host CLI and the in-VM runtime open the same SQLite file and must apply identical PRAGMAs (WAL, busy timeout, foreign keys, synchronous=NORMAL). Centralising the builder keeps that contract in one place — when a new PRAGMA is needed, this is the only file to edit.

Structs§

DbPools
Read pool + dedicated single-connection write pool for the same SQLite file. SQLite is single-writer system-wide, so a multi-connection pool fighting for the writer lock just generates SQLITE_BUSY and (under deferred transactions) SQLITE_BUSY_SNAPSHOT. Funnelling all writes from one process through a single connection turns within-process contention into an in-process queue (deterministic) instead of SQLite-level lock contention (probabilistic, retry-required). Reads keep the wider pool — WAL mode lets readers run concurrently.

Constants§

DEFAULT_BUSY_TIMEOUT_SECS
Default busy_timeout PRAGMA value used when a caller has no user-facing knob to plumb (e.g. the in-VM runtime, where the host owns DB-tuning policy and the runtime is not user-configurable).