pub struct MultiStorage { /* private fields */ }Expand description
Multi-backend storage that combines multiple backends for redundancy and load balancing Implements failover capabilities and load distribution
Implementations§
Source§impl MultiStorage
impl MultiStorage
Sourcepub fn new(backends: Vec<Arc<dyn StorageBackend>>) -> Self
pub fn new(backends: Vec<Arc<dyn StorageBackend>>) -> Self
Create a new multi-backend storage with redundant strategy
Sourcepub fn with_strategy(
backends: Vec<Arc<dyn StorageBackend>>,
strategy: MultiStorageStrategy,
) -> Self
pub fn with_strategy( backends: Vec<Arc<dyn StorageBackend>>, strategy: MultiStorageStrategy, ) -> Self
Create with specific strategy
Sourcepub fn add_backend(&mut self, backend: Arc<dyn StorageBackend>)
pub fn add_backend(&mut self, backend: Arc<dyn StorageBackend>)
Add a backend
Sourcepub fn remove_backend(
&mut self,
index: usize,
) -> Option<Arc<dyn StorageBackend>>
pub fn remove_backend( &mut self, index: usize, ) -> Option<Arc<dyn StorageBackend>>
Remove a backend
Sourcepub fn backend_count(&self) -> usize
pub fn backend_count(&self) -> usize
Get number of backends
Trait Implementations§
Source§impl StorageBackend for MultiStorage
impl StorageBackend for MultiStorage
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 MultiStorage
impl !RefUnwindSafe for MultiStorage
impl Send for MultiStorage
impl Sync for MultiStorage
impl Unpin for MultiStorage
impl !UnwindSafe for MultiStorage
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