pub struct SqliteStore { /* private fields */ }Expand description
An open store: its connection and the file it reads, when not in memory.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open(file: Option<&Path>, schema: &'static str, version: i32) -> Self
pub fn open(file: Option<&Path>, schema: &'static str, version: i32) -> Self
Open file (None: in memory) with schema (its statements idempotent) at schema version. A file that
cannot be opened, or holds another version, is reported (Warning) and left alone; the store is then in memory.
Sourcepub fn fell_back(&self) -> bool
pub fn fell_back(&self) -> bool
Whether a file was asked for and could not be used, so the store may not know what earlier runs stored there.
Sourcepub fn wants_file(&self) -> bool
pub fn wants_file(&self) -> bool
Whether a file was asked for: the store runs on it, or in memory in its place.
Sourcepub fn immediate<T>(
&mut self,
f: impl FnMut(&Transaction<'_>, bool) -> Result<T>,
) -> Option<T>
pub fn immediate<T>( &mut self, f: impl FnMut(&Transaction<'_>, bool) -> Result<T>, ) -> Option<T>
Run f in one IMMEDIATE transaction, committed when it succeeds. A file that fails is reported (Warning) and
replaced by memory (attempt, from copy), where f runs again: f is told whether the store runs in memory
in place of its file (Self::fell_back), and defers its own side effects (a Warning) until the call returns. A
transaction that fails in a fresh store in memory is reported (Error) and gives None.
Sourcepub fn read<T>(&mut self, f: impl Fn(&Connection) -> Result<T>) -> Option<T>
pub fn read<T>(&mut self, f: impl Fn(&Connection) -> Result<T>) -> Option<T>
A read outside any transaction, under Self::immediate’s failure policy.