Trait bee_storage::backend::StorageBackend
source · [−]pub trait StorageBackend: Send + Sized + Sync + 'static {
type ConfigBuilder: Default + DeserializeOwned + Into<Self::Config>;
type Config: Clone + Send + Sync;
type Error: Error + Send;
fn start(config: Self::Config) -> Result<Self, Self::Error>;
fn shutdown(self) -> Result<(), Self::Error>;
fn size(&self) -> Result<Option<usize>, Self::Error>;
fn get_health(&self) -> Result<Option<StorageHealth>, Self::Error>;
fn set_health(&self, health: StorageHealth) -> Result<(), Self::Error>;
}
Expand description
Trait to be implemented on a storage backend. Determines how to start and shutdown the backend.
Required Associated Types
sourcetype ConfigBuilder: Default + DeserializeOwned + Into<Self::Config>
type ConfigBuilder: Default + DeserializeOwned + Into<Self::Config>
Helps build the associated Config
.
Required Methods
Initializes and starts the backend.
Returns the size of the database in bytes. Not all backends may be able to provide this operation.
sourcefn get_health(&self) -> Result<Option<StorageHealth>, Self::Error>
fn get_health(&self) -> Result<Option<StorageHealth>, Self::Error>
Returns the health status of the database. Not all backends may be able to provide this operation.
sourcefn set_health(&self, health: StorageHealth) -> Result<(), Self::Error>
fn set_health(&self, health: StorageHealth) -> Result<(), Self::Error>
Sets the health status of the database. Not all backends may be able to provide this operation.