pub struct OpenOptions {
pub plan_queries: bool,
pub operator_storage: OperatorStorage,
pub journal: JournalMode,
pub wal_autocheckpoint: Option<u32>,
pub foreign_keys: ForeignKeys,
}Expand description
Everything an opener can be configured with, in one struct-with-Default — so
every combination (planner × operator storage × journal) is expressible without
a ladder of positional open_with_* rungs. Taken by Db::open_with,
Cluster::open_with, and
ClusterConsumer::open_with; the named
rungs (open, open_with_planning, open_with_journal, …) are conveniences
that fill one field each.
// An explicitly-wal2 store with the defaults otherwise:
let db = Db::open_with(
"app.db",
OpenOptions {
journal: JournalMode::Wal2,
..OpenOptions::default()
},
).unwrap();Fields§
§plan_queries: boolRun the cost-based join-flip planner at query registration (default true,
matching open). Result-preserving; the plan is frozen per registration.
operator_storage: OperatorStorageWhere stateful operators keep scratch state (default in-process memory).
journal: JournalModeThe journal mode a fresh (or explicitly-wal2) store gets (design 306 D5;
default JournalMode::Wal). JournalMode::Wal2 is a requirement, not a
preference — the opener fails if the store does not end up in wal2.
wal_autocheckpoint: Option<u32>PRAGMA wal_autocheckpoint for the writer connection, in pages (design 410
§3.5). None (the default) leaves SQLite’s own default of 1000 pages — what
every server-side opener wants. Some(0) disables the automatic checkpoint
entirely, so the WAL folds back only on an explicit
maintain pass: the embedded/mobile posture, where an
unpredictable checkpoint landing inside whichever commit happens to cross the
threshold is worse than a deliberate one at a moment the app picks (gesture end,
idle, backgrounding). Connection-local, so it must be re-passed at every open.
foreign_keys: ForeignKeysWhether SQLite enforces declared foreign keys on this store’s read-write
connections (default ForeignKeys::Enforced, matching the vendored build’s
compile-time default).
ForeignKeys::Enforced is the origin posture — right for an embedded
Db, a directly-driven Cluster, and the standalone daemon’s write plane,
where a violated constraint is the application’s bug. An apply plane — a
follower replaying a master’s journal — passes ForeignKeys::Unenforced,
because those rows were validated upstream, arrive in the stream’s order rather
than a topological one, and carry the authority’s cascade effects as ordinary
row changes that must not be re-run locally. See
[rindle_writeplane::foreign_keys] for the full argument, and
Cluster::foreign_key_audit for the audit
that proves referential integrity either way.
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more