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

Helps build the associated Config.

Holds the backend options.

Returned on failed operations.

Required Methods

Initializes and starts the backend.

Shutdowns the backend.

Returns the size of the database in bytes. Not all backends may be able to provide this operation.

Returns the health status of the database. Not all backends may be able to provide this operation.

Sets the health status of the database. Not all backends may be able to provide this operation.

Implementors