Skip to main content

Module connection

Module connection 

Available on crate features event-store or projection-store only.
Expand description

The one connection configuration both stores in this crate use.

An event store and a projection store on one file are two connections, not one, and they have to agree: a projection connection with no busy timeout fails instantly against the event store’s BEGIN IMMEDIATE write lock, and the symptom then appears three stories away from its cause. So the settings live here, in one function, rather than once per role.

§A pragma that executed is not a pragma that is in effect

SQLite silently accepts a pragma it does not recognise — a misspelling is not an error, it is a no-op — and journal_mode in particular can refuse the value it was given (an in-memory database has no WAL to switch to) and report the mode it kept instead. ConnectionSettings::read_back is what turns that from an assumption into an observation: the value asserted on comes off the live connection rather than out of the constants below.

Structs§

ConnectionSettings
What one connection is actually running under, read off that connection.

Constants§

BUSY_TIMEOUT_MS
How long a connection waits for a contended write lock before giving up, in milliseconds.
JOURNAL_MODE
The journal mode every connection this crate opens runs under, as SQLite reports it back.
SYNCHRONOUS
The synchronous setting every connection this crate opens runs under, as the integer PRAGMA synchronous answers.

Functions§

configure
Applies this crate’s settings to an already-open connection.
open_configured
Opens (creating if absent) the database at path and configures it.