pub struct PoolConfig {
pub path: Option<PathBuf>,
pub max_readers: usize,
pub wal_mode: bool,
pub busy_timeout: Duration,
pub checkout_timeout: Duration,
pub wal_autocheckpoint_pages: u32,
pub journal_size_limit_bytes: i64,
pub read_only: bool,
pub write_queue_enabled: bool,
pub write_queue_capacity: usize,
}Expand description
Configuration for the connection pool.
Fields§
§path: Option<PathBuf>Database path. None = in-memory (pool degrades to single connection).
max_readers: usizeNumber of reader connections (default: min(num_cpus, 8)).
wal_mode: boolWAL mode (must be true for pooling to work; default: true).
busy_timeout: DurationBusy timeout per connection (default: 30s).
Overridable via KHIVE_BUSY_TIMEOUT_SECS.
checkout_timeout: DurationTime to wait for a reader connection before returning an error (default: 5s).
Overridable via KHIVE_CHECKOUT_TIMEOUT_SECS.
wal_autocheckpoint_pages: u32Number of WAL pages that triggers an automatic checkpoint.
Maps to PRAGMA wal_autocheckpoint. The default (4000 pages, ~16 MiB
at SQLite’s default 4 KiB page size) matches the pre-config behaviour.
Overridable via KHIVE_WAL_AUTOCHECKPOINT_PAGES.
journal_size_limit_bytes: i64Maximum WAL journal size in bytes before SQLite resets the WAL.
Maps to PRAGMA journal_size_limit. Default: 64 MiB.
Overridable via KHIVE_JOURNAL_SIZE_LIMIT_BYTES.
read_only: boolOpen the database read-only (default: false).
When true, the pool’s writer connection is opened with
SQLITE_OPEN_READ_ONLY (no SQLITE_OPEN_CREATE, so a missing path is
rejected instead of created) and PRAGMA query_only = ON is set on
every connection that can execute SQL. Reader connections are already
opened read-only regardless of this flag.
write_queue_enabled: boolRoute migrated store write paths through the single-writer
WriterTask channel (ADR-067 Component A) instead of the legacy
per-call pool-mutex/standalone-connection path. Off by default.
Slice 1 wires exactly one path (SqlEntityStore::upsert_entities)
behind this flag; enabling it does not yet claim ADR-067’s
single-writer guarantee — other write paths still open their own
writers until later slices migrate them.
Overridable via KHIVE_WRITE_QUEUE ("1" or "true",
case-insensitive, enables it; anything else, or unset, leaves it off).
write_queue_capacity: usizeBounded channel capacity for the WriterTask write queue.
Overridable via KHIVE_WRITE_QUEUE_CAPACITY. Default: 256 pending
operations (ADR-067 Component A recommended default).
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§fn clone(&self) -> PoolConfig
fn clone(&self) -> PoolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more