pub struct Storage { /* private fields */ }Expand description
Storage engine wrapping SQLite with connection pooling
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open(config: StorageConfig) -> Result<Self>
pub fn open(config: StorageConfig) -> Result<Self>
Open or create a database with the given configuration
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Open with default configuration (in-memory for testing)
Sourcepub fn connection(&self) -> MutexGuard<'_, Connection>
pub fn connection(&self) -> MutexGuard<'_, Connection>
Get a reference to the connection (for single-threaded use)
Sourcepub fn with_connection<F, T>(&self, f: F) -> Result<T>
pub fn with_connection<F, T>(&self, f: F) -> Result<T>
Execute a function with the connection
Sourcepub fn with_transaction<F, T>(&self, f: F) -> Result<T>
pub fn with_transaction<F, T>(&self, f: F) -> Result<T>
Execute a function with a transaction
Sourcepub fn storage_mode(&self) -> StorageMode
pub fn storage_mode(&self) -> StorageMode
Get current storage mode
Sourcepub fn is_in_cloud_folder(&self) -> bool
pub fn is_in_cloud_folder(&self) -> bool
Check if database is in a cloud-synced folder
Sourcepub fn storage_mode_warning(&self) -> Option<String>
pub fn storage_mode_warning(&self) -> Option<String>
Get warning if storage mode doesn’t match folder type
Sourcepub fn checkpoint(&self) -> Result<()>
pub fn checkpoint(&self) -> Result<()>
Checkpoint WAL file (for local mode)
Sourcepub fn config(&self) -> &StorageConfig
pub fn config(&self) -> &StorageConfig
Get configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
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 moreCreates a shared type from an unshared type.