Skip to main content

Module worker

Module worker 

Source
Expand description

Single-threaded native SQLite command worker. Runs each database’s SQLite commands on a shared pool of plain OS threads.

Every database is a serial queue: at most one pool thread holds its connection at a time, runs one command, and requeues the database if more work is waiting. A connection with an open explicit transaction stays with its database between commands and holds no thread. Pool threads must be plain OS threads, never Tokio workers, because VFS callbacks block on the Tokio runtime with block_on and sleep with std::thread::sleep.

Structs§

SqlitePool
A bounded pool of plain OS threads shared by every database of one runtime process. The pool spawns threads lazily, up to its cap, only when no thread is free. Cloning shares the pool; it shuts down once the owner and every database handle have dropped their clones.
SqliteWorkerCloseTimeoutError
SqliteWorkerClosingError
SqliteWorkerDeadError
SqliteWorkerFatalError
SqliteWorkerHandle
SqliteWorkerOverloadedError
SqliteWorkerResult

Constants§

DEFAULT_SQLITE_WORKER_THREADS
SQLITE_WORKER_QUEUE_CAPACITY
SQLITE_WORKER_THREADS_ENV
Environment variable that sizes the process pool.

Traits§

SqlitePoolMetrics
Process-level pool gauges. Implemented by the runtime that owns the pool.