pub struct DatabaseConfig {
pub columns: u32,
pub flags: OpenFlags,
pub num_conns: usize,
pub vacuum_mode: VacuumMode,
pub repair_on_corrupt: bool,
pub repair_check: RepairCheck,
pub repair_check_byte_limit: Option<u64>,
pub on_repair: Option<RepairCallback>,
}Expand description
Database configuration
Fields§
§columns: u32Set number of columns. The number of columns must not be zero.
flags: OpenFlagsSet flags used to open the database
num_conns: usizeNumber of connections to open
vacuum_mode: VacuumModeVacuum mode
repair_on_corrupt: boolOn corruption, at open or at runtime, salvage the readable rows into a fresh database, keeping the damaged files beside it
repair_check: RepairCheckWhich integrity check gates the open-time repair
repair_check_byte_limit: Option<u64>Skip the open-time check when the database (plus WAL) is larger than this; the check reads every page, so on a large store it can hold up open for a long time, and runtime repair still covers what it would have caught. None checks regardless of size.
on_repair: Option<RepairCallback>Called with a report every time a repair runs
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn with_columns(self, columns: u32) -> Self
pub fn with_columns(self, columns: u32) -> Self
Set the number of columns. columns must not be zero.
Sourcepub fn with_repair_on_corrupt(self, repair_on_corrupt: bool) -> Self
pub fn with_repair_on_corrupt(self, repair_on_corrupt: bool) -> Self
Enable corruption detection and salvage, at open and at runtime
Sourcepub fn with_repair_check(self, repair_check: RepairCheck) -> Self
pub fn with_repair_check(self, repair_check: RepairCheck) -> Self
Set which integrity check gates the open-time repair
Sourcepub fn with_repair_check_byte_limit(self, bytes: u64) -> Self
pub fn with_repair_check_byte_limit(self, bytes: u64) -> Self
Skip the open-time check for databases larger than bytes
Sourcepub fn with_on_repair(self, on_repair: RepairCallback) -> Self
pub fn with_on_repair(self, on_repair: RepairCallback) -> Self
Set a callback invoked with a report every time a repair runs
Sourcepub fn with_in_memory(self) -> Self
pub fn with_in_memory(self) -> Self
Sets the flags to ‘in-memory database’
Sourcepub fn with_flags(self, flags: OpenFlags) -> Self
pub fn with_flags(self, flags: OpenFlags) -> Self
Replaces all the flags
Sourcepub fn with_num_conns(self, num_conns: usize) -> Self
pub fn with_num_conns(self, num_conns: usize) -> Self
Sets the number of connections for this database
Sourcepub fn with_vacuum_mode(self, vacuum_mode: VacuumMode) -> Self
pub fn with_vacuum_mode(self, vacuum_mode: VacuumMode) -> Self
Set the vacuum mode used by ‘cleanup’
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§fn clone(&self) -> DatabaseConfig
fn clone(&self) -> DatabaseConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more