pub trait StorageBackend:
Send
+ Sized
+ Sync
+ 'static {
type ConfigBuilder: Default + DeserializeOwned + Into<Self::Config>;
type Config: Clone + Send + Sync;
type Error: Error + Send;
// Required methods
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§
Sourcefn start(config: Self::Config) -> Result<Self, Self::Error>
fn start(config: Self::Config) -> Result<Self, Self::Error>
Initializes and starts the backend.
Sourcefn size(&self) -> Result<Option<usize>, Self::Error>
fn size(&self) -> Result<Option<usize>, Self::Error>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.