pub struct Config { /* private fields */ }Expand description
Db open-time configuration. Construct via Config::default
and modify with the builder methods.
Implementations§
Source§impl Config
impl Config
Sourcepub fn cache_size(self, bytes: usize) -> Result<Self>
pub fn cache_size(self, bytes: usize) -> Result<Self>
Set the pager’s LRU cache size, in bytes. Rounded down to the nearest 4 KiB page.
§Errors
Returns obj_core::Error::InvalidArgument if the
resulting frame count is zero.
Sourcepub fn sync_mode(self, mode: SyncMode) -> Self
pub fn sync_mode(self, mode: SyncMode) -> Self
Set the durability mode the WAL uses for every commit.
Sourcepub fn busy_timeout(self, timeout: Duration) -> Self
pub fn busy_timeout(self, timeout: Duration) -> Self
Set the cross-process / in-process busy-lock timeout.
WriteTxn::begin and ReadTxn::begin return
Err(Error::Busy) if the relevant lock cannot be acquired
within this budget.
Sourcepub fn skip_open_check(self, skip: bool) -> Self
pub fn skip_open_check(self, skip: bool) -> Self
Skip the lightweight open-time integrity check (M11 #91).
By default (false), crate::Db::open / crate::Db::open_with
run a fast subset of crate::Db::integrity_check before
returning: file-header CRC, catalog root sanity, catalog
B-tree CRC + invariants, and per-collection pointer-range
validation. The walk is bounded to the catalog tree only —
no per-collection deep walk — so the cost is essentially
independent of the database’s total size.
Set to true to opt out. The knob exists for narrow use
cases — fault-injection harnesses that deliberately open a
corrupted DB to exercise downstream error paths, hot-reload
tooling that re-opens the same file many times per second,
or developer workflows that have just run a full
Db::integrity_check and don’t want to repeat the catalog
portion. Production callers SHOULD leave it on.
Skipping the open check does NOT bypass detection: a
corrupted page surfaces on the first operation that touches
it. Note also that the obj Db constructor performs an
implicit Catalog::open_or_init that reads the catalog
B-tree’s reserved row; a DB whose catalog tree is so
corrupted that descend fails will still error out of the
open path even with skip_open_check(true). The knob’s
guarantee is “no EXTRA walk beyond what was already
required to construct the Db handle.”
Sourcepub fn cross_process_lock(self, enabled: bool) -> Self
pub fn cross_process_lock(self, enabled: bool) -> Self
Enable / disable the cross-process file lock layer.
When false, the Db opened with this config
does NOT acquire OS-level byte-range locks on the database
file. Used by the M6 #49 concurrent stress test where every
thread shares one Db (and therefore one file descriptor):
POSIX OFD locks are per-fd, so multiple threads on the same
fd cannot use the lock to enforce inter-thread exclusion —
that’s what the in-process write-serialization mutex is for.
Default: true (cross-process locking enabled).