Module connection
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§
- Connection
Settings - 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
synchronoussetting every connection this crate opens runs under, as the integerPRAGMA synchronousanswers.
Functions§
- configure
- Applies this crate’s settings to an already-open connection.
- open_
configured - Opens (creating if absent) the database at
pathand configures it.