pub struct StorageManager { /* private fields */ }Expand description
Manage all storage providers.
§Example
use dispnet_storage::storage_manager::StorageManager;
let mut manager = StorageManager::new();Implementations§
Source§impl StorageManager
impl StorageManager
pub fn new() -> Self
Sourcepub fn add_storage_provider(
&mut self,
layer_key: String,
provider: Box<dyn StorageProvider>,
)
pub fn add_storage_provider( &mut self, layer_key: String, provider: Box<dyn StorageProvider>, )
Add a storage provider instance to the manager
Sourcepub fn remove_storage_provider(&mut self, layer_key: &str)
pub fn remove_storage_provider(&mut self, layer_key: &str)
Remove a loaded storage provider instance
Sourcepub fn get_storage_provider_layers(&self) -> Vec<&String>
pub fn get_storage_provider_layers(&self) -> Vec<&String>
Get all layers.
Layers are the names of storage provider instances.
Sourcepub fn get(&self, layer_key: &str, key: &str) -> Result<GetData, String>
pub fn get(&self, layer_key: &str, key: &str) -> Result<GetData, String>
Get data from a storage layer with a key.
Sourcepub fn find(&self, key: &str) -> Result<GetData, String>
pub fn find(&self, key: &str) -> Result<GetData, String>
Find the first data entry for the key in any storage provider.
Sourcepub fn save(
&self,
layer_key: &str,
key: &str,
raw: Vec<u8>,
) -> Result<SaveData, String>
pub fn save( &self, layer_key: &str, key: &str, raw: Vec<u8>, ) -> Result<SaveData, String>
Save data to the storage layer.
Sourcepub fn delete(&self, layer_key: &str, key: &str)
pub fn delete(&self, layer_key: &str, key: &str)
Queue an entry for deletion in a specific layer.
Sourcepub fn delete_all(&self, key: &str)
pub fn delete_all(&self, key: &str)
Queue for deletion all entires which match the key on any layer.
Sourcepub fn force_free(&self, all: bool)
pub fn force_free(&self, all: bool)
Executes force free on all layers.
Auto Trait Implementations§
impl !RefUnwindSafe for StorageManager
impl !Send for StorageManager
impl !Sync for StorageManager
impl !UnwindSafe for StorageManager
impl Freeze for StorageManager
impl Unpin for StorageManager
impl UnsafeUnpin for StorageManager
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