pub struct FilesystemBackend<K, V, M = ()>{ /* private fields */ }Expand description
Filesystem storage backend.
Each backend instance is safe for concurrent use. Multiple backend instances or processes must not write to the same directory concurrently.
Implementations§
Source§impl<K, V, M> FilesystemBackend<K, V, M>
impl<K, V, M> FilesystemBackend<K, V, M>
Sourcepub async fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
pub async fn new<P: AsRef<Path>>(base_path: P) -> Result<Self>
Create a new filesystem backend with the given base path.
Sourcepub fn with_max_snapshot_bytes(self, max_snapshot_bytes: u64) -> Self
pub fn with_max_snapshot_bytes(self, max_snapshot_bytes: u64) -> Self
Set the maximum accepted and generated snapshot size in bytes.
A zero-byte limit is permitted but makes every snapshot write fail.
Trait Implementations§
Source§impl<K, V, M> StorageBackend for FilesystemBackend<K, V, M>
impl<K, V, M> StorageBackend for FilesystemBackend<K, V, M>
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 EntryMap<K, V, M>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 EntryMap<K, V, M>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save entries to storage
Source§fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<EntryMap<K, V, M>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<EntryMap<K, V, M>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load entries from storage
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove entries for a specific key
Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all entries from storage
Source§fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if storage contains a key
Auto Trait Implementations§
impl<K, V, M = ()> !RefUnwindSafe for FilesystemBackend<K, V, M>
impl<K, V, M = ()> !UnwindSafe for FilesystemBackend<K, V, M>
impl<K, V, M> Freeze for FilesystemBackend<K, V, M>
impl<K, V, M> Send for FilesystemBackend<K, V, M>
impl<K, V, M> Sync for FilesystemBackend<K, V, M>
impl<K, V, M> Unpin for FilesystemBackend<K, V, M>
impl<K, V, M> UnsafeUnpin for FilesystemBackend<K, V, M>
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