Skip to main content

StorageManager

Struct StorageManager 

Source
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

Source

pub fn new() -> Self

Source

pub fn add_storage_provider( &mut self, layer_key: String, provider: Box<dyn StorageProvider>, )

Add a storage provider instance to the manager

Source

pub fn remove_storage_provider(&mut self, layer_key: &str)

Remove a loaded storage provider instance

Source

pub fn get_storage_provider_layers(&self) -> Vec<&String>

Get all layers.

Layers are the names of storage provider instances.

Source

pub fn get(&self, layer_key: &str, key: &str) -> Result<GetData, String>

Get data from a storage layer with a key.

Source

pub fn find(&self, key: &str) -> Result<GetData, String>

Find the first data entry for the key in any storage provider.

Source

pub fn save( &self, layer_key: &str, key: &str, raw: Vec<u8>, ) -> Result<SaveData, String>

Save data to the storage layer.

Source

pub fn delete(&self, layer_key: &str, key: &str)

Queue an entry for deletion in a specific layer.

Source

pub fn delete_all(&self, key: &str)

Queue for deletion all entires which match the key on any layer.

Source

pub fn free(&self)

Execute free on all layers.

Source

pub fn force_free(&self, all: bool)

Executes force free on all layers.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.