pub struct OpenOptions {
pub lock_timeout_ms: u32,
pub memory_budget_bytes: Option<u64>,
pub temp_disk_budget_bytes: Option<u64>,
pub offline_validation: bool,
}Expand description
Knobs for Database::open_with_options.
All fields default to the same values the convenience
Database::open / [Database::open_encrypted] / etc. constructors use,
so OpenOptions::default() round-trips the historical behavior exactly.
Fields§
§lock_timeout_ms: u32Maximum time, in milliseconds, to wait for the cross-process database
lock (_meta/.lock) before failing with MongrelError::DatabaseLocked.
0 (the default) preserves the historical fail-fast semantics: a
single try_lock_exclusive call, no retry, no sleep. SQLite-style
busy_timeout semantics kick in once this is non-zero — the open
sleeps with progressively wider backoff (1ms → 10ms → 50ms) until
either the lock is acquired or lock_timeout_ms elapses, at which
point the open returns the same typed lock error as the fail-fast path.
Only the cross-process lock is affected. Mounted tables, page-cache
misses, and WAL appends already serialize through in-process locks
that handle their own contention. A second independent open in the
same process always returns DatabaseLocked immediately; share the
existing Arc<Database> instead.
memory_budget_bytes: Option<u64>Total bytes the storage core’s crate::memory::MemoryGovernor may
hand out across every memory class (S1E-003). None (the default)
uses DEFAULT_MEMORY_BUDGET_BYTES. The governor is a reservation
accounting layer, not an allocation: this is a cap, not a preallocation.
temp_disk_budget_bytes: Option<u64>Total bytes of live spill files the core’s
crate::spill::SpillManager allows across every query (S1E-004).
None (the default) uses DEFAULT_TEMP_DISK_BUDGET_BYTES. Again a
cap, not a preallocation.
offline_validation: boolOpen the database through the special offline-validation API (spec
section 5.3): any crate::storage_mode::StorageMode — including
ClusterReplica, which every normal open path rejects — is opened
read-only so a backup validator can inspect it. The opened core
rejects every write with MongrelError::ReadOnlyReplica. This is the
only way to open a cluster replica outside the cluster node runtime.
Implementations§
Source§impl OpenOptions
impl OpenOptions
Sourcepub fn with_lock_timeout_ms(self, ms: u32) -> Self
pub fn with_lock_timeout_ms(self, ms: u32) -> Self
Set OpenOptions::lock_timeout_ms. 0 keeps the fail-fast default;
SQLite-style applications typically pick 1_000 – 5_000ms.
Sourcepub fn with_memory_budget_bytes(self, bytes: u64) -> Self
pub fn with_memory_budget_bytes(self, bytes: u64) -> Self
Sourcepub fn with_temp_disk_budget_bytes(self, bytes: u64) -> Self
pub fn with_temp_disk_budget_bytes(self, bytes: u64) -> Self
Sourcepub fn with_offline_validation(self, offline_validation: bool) -> Self
pub fn with_offline_validation(self, offline_validation: bool) -> Self
Set OpenOptions::offline_validation. true opens any storage mode
read-only (the offline backup-validator API of spec section 5.3).
Trait Implementations§
Source§impl Clone for OpenOptions
impl Clone for OpenOptions
Source§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenOptions
impl Debug for OpenOptions
Source§impl Default for OpenOptions
impl Default for OpenOptions
Source§fn default() -> OpenOptions
fn default() -> OpenOptions
Auto Trait Implementations§
impl Freeze for OpenOptions
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnsafeUnpin for OpenOptions
impl UnwindSafe for OpenOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more