use thiserror::Error;
#[derive(Debug, Error)]
pub enum StoreError {
#[error(transparent)]
SerializationError(#[from] serde_json::Error),
#[error(transparent)]
IOError(#[from] std::io::Error),
}
pub trait PersistentStore {
fn save(
&mut self,
key: &str,
value: &str,
) -> impl std::future::Future<Output = Result<(), StoreError>> + Send;
fn load(
&self,
key: &str,
) -> impl std::future::Future<Output = Result<Option<String>, StoreError>> + Send;
fn delete(
&mut self,
key: &str,
) -> impl std::future::Future<Output = Result<(), StoreError>> + Send;
fn exists(
&self,
key: &str,
) -> impl std::future::Future<Output = Result<bool, StoreError>> + Send;
}