pub struct MemoryStorage { /* private fields */ }Expand description
In-memory storage implementation for testing and caching Stores shards and metadata in HashMap structures
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Get the number of stored shards
Sourcepub fn metadata_count(&self) -> usize
pub fn metadata_count(&self) -> usize
Get the number of stored metadata entries
Trait Implementations§
Source§impl Default for MemoryStorage
impl Default for MemoryStorage
Source§impl StorageBackend for MemoryStorage
impl StorageBackend for MemoryStorage
Source§fn put_shard<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
shard: &'life2 Shard,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_shard<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
shard: &'life2 Shard,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a shard with the given CID
Source§fn get_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Shard, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Shard, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a shard by CID
Source§fn delete_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a shard by CID
Source§fn has_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<bool, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_shard<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<bool, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a shard exists
Source§fn list_shards<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Cid>, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_shards<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Cid>, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all shard CIDs in storage
Source§fn put_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
metadata: &'life1 FileMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
metadata: &'life1 FileMetadata,
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store file metadata
Source§fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<FileMetadata, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<FileMetadata, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve file metadata
Source§fn delete_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
file_id: &'life1 [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<(), FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete file metadata
Source§fn list_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileMetadata>, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileMetadata>, FecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all file metadata
Auto Trait Implementations§
impl Freeze for MemoryStorage
impl RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl UnwindSafe for MemoryStorage
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