pub struct DbOptions {
pub path: PathBuf,
pub key: Option<Zeroizing<String>>,
pub raw_key: Option<Zeroizing<[u8; 32]>>,
pub profile: CacheProfile,
pub durability: DurabilityProfile,
pub foreign_keys: bool,
pub integrity_check_on_open: bool,
pub journal: JournalSelect,
pub owner_only: bool,
pub init: Option<ConnInit>,
pub journal_env: Option<String>,
pub per_host_fallback: bool,
}Fields§
§path: PathBuf§key: Option<Zeroizing<String>>SQLCipher passphrase-style key (base64-ish charset). See also DbOptions::raw_key.
raw_key: Option<Zeroizing<[u8; 32]>>SQLCipher raw 256-bit key, applied as x'<hex>' (no KDF). Takes precedence over key.
profile: CacheProfile§durability: DurabilityProfile§foreign_keys: bool§integrity_check_on_open: bool§journal: JournalSelect§owner_only: boolNarrow the database and its sidecars to owner-only (0600) on unix. Default on.
init: Option<ConnInit>§journal_env: Option<String>The app’s own kill-switch variable (e.g. CODERIGHT_SQLITE_JOURNAL_MODE), checked
before JOURNAL_ENV.
per_host_fallback: boolWhen a rollback journal is in force (network mount, kill switch, or WAL refused),
open the per-host sibling per_host_path instead of the requested file, so hosts
sharing a network directory never share one rollback-journaled database. The
requested file is not created. Default off.
Implementations§
Source§impl DbOptions
impl DbOptions
Sourcepub fn open_writer_migrated(
&self,
migrations: &[Migration],
options: &MigrateOptions,
) -> Result<(Connection, MigrationReport)>
pub fn open_writer_migrated( &self, migrations: &[Migration], options: &MigrateOptions, ) -> Result<(Connection, MigrationReport)>
Open the writer and bring the schema up to date (see migrate); the pre-migration
backup is keyed like the database itself.
Source§impl DbOptions
impl DbOptions
Sourcepub fn open_writer_with_key_candidates(
&self,
candidates: &[Zeroizing<String>],
) -> Result<(Connection, usize)>
pub fn open_writer_with_key_candidates( &self, candidates: &[Zeroizing<String>], ) -> Result<(Connection, usize)>
Try each passphrase in order; the first that decrypts opens the writer.
Sourcepub fn open_writer_recovering(
&self,
policy: RecoveryPolicy,
) -> Result<OpenOutcome>
pub fn open_writer_recovering( &self, policy: RecoveryPolicy, ) -> Result<OpenOutcome>
Open the writer; if the file is unreadable and the policy allows it, quarantine it and open a fresh database at the same path.
Source§impl DbOptions
impl DbOptions
pub fn new(path: impl Into<PathBuf>) -> Self
pub fn with_journal_env(self, name: impl Into<String>) -> Self
pub fn with_per_host_fallback(self, on: bool) -> Self
Sourcepub fn effective_path(&self) -> PathBuf
pub fn effective_path(&self) -> PathBuf
The file connections actually open: the requested path, or its per-host sibling when
Self::per_host_fallback applies (a rollback journal is in force, or a writer
already fell back there).