pub enum ConnectionProfile {
Primary {
create: bool,
},
ReadOnly,
Maintenance {
write: bool,
},
}Expand description
Named connection policy profiles.
Variants§
Primary
Production read-write policy: WAL, synchronous=FULL, shared busy
timeout. create: true creates parent directories and the file;
create: false refuses to create (no-create writer, for files whose
creation is owned elsewhere).
ReadOnly
Passive read-only observation. Never creates the database file, never
mutates pragmas, never alters logical database content. Reading a
database that is in WAL mode may still create or update its
-wal/-shm sidecar files (see
WriteContact::ReadOnlyWalSidecars).
Maintenance
Fail-fast maintenance access for offline work: zero busy timeout by
default (a held lock surfaces immediately instead of stalling), never
creates, never mutates pragmas. write: false opens read-only.
Implementations§
Source§impl ConnectionProfile
impl ConnectionProfile
Sourcepub fn journal_policy(self) -> JournalPolicy
pub fn journal_policy(self) -> JournalPolicy
What an open under this profile does to the file’s journal mode.
Maintenance { write: true } is the one read-write profile that
preserves the mode it finds, and deliberately: it is the offline
surgeon’s profile, taken by the party holding the exclusive
maintenance fence to bridge ledgers or to archive a file by rename.
Converting the journal mode of a database another step is about to
relocate is a mutation outside that mandate, and it would leave
sidecars beside bytes that are about to move. Durable serving traffic
therefore never uses that profile; it uses
ConnectionProfile::Primary, which establishes and verifies WAL or
refuses the open.
Sourcepub fn write_contact(self) -> WriteContact
pub fn write_contact(self) -> WriteContact
The strongest no-write guarantee an open under this profile makes.
Trait Implementations§
Source§impl Clone for ConnectionProfile
impl Clone for ConnectionProfile
Source§fn clone(&self) -> ConnectionProfile
fn clone(&self) -> ConnectionProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more