pub struct SqliteCache { /* private fields */ }Expand description
SQLite cache backend. Cheap to clone (Arc<Mutex<Connection>> shared).
Implementations§
Source§impl SqliteCache
impl SqliteCache
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open (or create) the cache database at path. Creates the parent
directory if needed and applies the schema on first use.
§Errors
CacheError::Iowhen the parent directory cannot be created.CacheError::Backendwhenrusqlitecannot open the file or apply the schema.
Sourcepub fn in_memory() -> Result<Self>
pub fn in_memory() -> Result<Self>
Open an in-memory cache. Convenient for tests; data is lost on drop.
§Errors
CacheError::Backend when rusqlite cannot open the in-memory
connection or apply the schema (extremely unlikely in practice).
Trait Implementations§
Source§impl Cache for SqliteCache
impl Cache for SqliteCache
Source§fn record_batch<'life0, 'async_trait>(
&'life0 mut self,
events: Vec<BuildEvent>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_batch<'life0, 'async_trait>(
&'life0 mut self,
events: Vec<BuildEvent>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Override the default Cache::record_batch impl with a single
SQLite transaction so the whole layer’s events land atomically.
Without this the default loops record and any crash mid-batch
leaves the cache half-updated.
Source§fn last_build<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ActionId,
) -> Pin<Box<dyn Future<Output = Option<BuildEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn last_build<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ActionId,
) -> Pin<Box<dyn Future<Output = Option<BuildEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Last recorded event for
id, or None if the action has never run.Source§impl Clone for SqliteCache
impl Clone for SqliteCache
Source§fn clone(&self) -> SqliteCache
fn clone(&self) -> SqliteCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqliteCache
impl RefUnwindSafe for SqliteCache
impl Send for SqliteCache
impl Sync for SqliteCache
impl Unpin for SqliteCache
impl UnsafeUnpin for SqliteCache
impl UnwindSafe for SqliteCache
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