Skip to main content

PoolConfig

Struct PoolConfig 

Source
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: usize

Number of reader connections (default: min(num_cpus, 8)).

§wal_mode: bool

WAL mode (must be true for pooling to work; default: true).

§busy_timeout: Duration

Busy timeout per connection (default: 30s).

Overridable via KHIVE_BUSY_TIMEOUT_SECS.

§checkout_timeout: Duration

Time to wait for a reader connection before returning an error (default: 5s).

Overridable via KHIVE_CHECKOUT_TIMEOUT_SECS.

§wal_autocheckpoint_pages: u32

Number 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: i64

Maximum 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: bool

Open 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: bool

Route 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: usize

Bounded 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

Source§

fn clone(&self) -> PoolConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PoolConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PoolConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more