pub struct SqliteConfig {
pub path: DbPath,
pub flags: OpenFlags,
pub journal_mode: JournalMode,
pub synchronous_mode: SynchronousMode,
pub temp_store: TempStore,
pub cache_size: u32,
pub wal_autocheckpoint: u32,
pub page_size: u32,
pub mmap_size: u64,
}Expand description
Configuration for SQLite storage backend
Fields§
§path: DbPath§flags: OpenFlags§journal_mode: JournalMode§synchronous_mode: SynchronousMode§temp_store: TempStore§cache_size: u32§wal_autocheckpoint: u32§page_size: u32§mmap_size: u64Implementations§
Source§impl SqliteConfig
impl SqliteConfig
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Self
pub fn new<P: AsRef<Path>>(path: P) -> Self
Create a new SqliteConfig with the specified database path
Sourcepub fn safe<P: AsRef<Path>>(path: P) -> Self
pub fn safe<P: AsRef<Path>>(path: P) -> Self
Create a safety-first configuration optimized for data integrity
- WAL journal mode for crash recovery
- FULL synchronous mode for maximum durability
- FILE temp store for persistence
- Conservative pool size
Sourcepub fn fast<P: AsRef<Path>>(path: P) -> Self
pub fn fast<P: AsRef<Path>>(path: P) -> Self
Create a high-performance configuration optimized for speed
- MEMORY journal mode for fastest writes
- OFF synchronous mode for minimal disk I/O
- MEMORY temp store for fastest temp operations
- Larger pool size for concurrency
Sourcepub fn tmpfs() -> Self
pub fn tmpfs() -> Self
Create a tmpfs configuration for temporary database storage
- Tmpfs-backed database with WAL mode for concurrent access
- Uses /tmp which may or may not be tmpfs (system-dependent)
- WAL journal mode for concurrent readers + single writer
- OFF synchronous mode for maximum speed
- MEMORY temp store
- Automatic cleanup on drop
Sourcepub fn in_memory() -> Self
pub fn in_memory() -> Self
Create an in-memory configuration for production use
- RAM-only database with WAL mode for concurrent access
- Uses /dev/shm on Linux, temp dir on other platforms
- WAL journal mode for concurrent readers + single writer
- NORMAL synchronous mode (safe for RAM storage)
- MEMORY temp store
- Automatic cleanup on drop
Sourcepub fn test() -> Self
pub fn test() -> Self
Create a test configuration optimized for testing with in-memory database
- RAM-only database with WAL mode for concurrent access
- Uses /dev/shm on Linux, temp dir on other platforms
- WAL journal mode for concurrent readers + single writer
- FULL synchronous mode for test safety
- MEMORY temp store for fastest temp operations
- Automatic cleanup on drop
Sourcepub fn journal_mode(self, mode: JournalMode) -> Self
pub fn journal_mode(self, mode: JournalMode) -> Self
Set the journal mode
Sourcepub fn synchronous_mode(self, mode: SynchronousMode) -> Self
pub fn synchronous_mode(self, mode: SynchronousMode) -> Self
Set the synchronous mode
Sourcepub fn temp_store(self, store: TempStore) -> Self
pub fn temp_store(self, store: TempStore) -> Self
Set the temp store location
Sourcepub fn cache_size(self, size_kb: u32) -> Self
pub fn cache_size(self, size_kb: u32) -> Self
Set the cache size in KB (will be negated when passed to SQLite)
Sourcepub fn wal_autocheckpoint(self, pages: u32) -> Self
pub fn wal_autocheckpoint(self, pages: u32) -> Self
Set WAL auto-checkpoint threshold in pages (0 = disable)
Trait Implementations§
Source§impl Clone for SqliteConfig
impl Clone for SqliteConfig
Source§fn clone(&self) -> SqliteConfig
fn clone(&self) -> SqliteConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqliteConfig
impl Debug for SqliteConfig
Auto Trait Implementations§
impl Freeze for SqliteConfig
impl RefUnwindSafe for SqliteConfig
impl Send for SqliteConfig
impl Sync for SqliteConfig
impl Unpin for SqliteConfig
impl UnsafeUnpin for SqliteConfig
impl UnwindSafe for SqliteConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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