1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use async_trait::async_trait;
use serde::de::DeserializeOwned;
#[async_trait]
pub trait StorageBackend: Send + Sized + Sync + 'static {
type ConfigBuilder: Default + DeserializeOwned + Into<Self::Config>;
type Config: Clone + Send + Sync;
type Error: std::error::Error + Send;
async fn start(config: Self::Config) -> Result<Self, Self::Error>;
async fn shutdown(self) -> Result<(), Self::Error>;
async fn size(&self) -> Result<Option<usize>, Self::Error>;
}