pub mod memory;
use async_trait::async_trait;
use crate::callbacks::Finitomata;
use crate::error::PersistencyError;
use crate::state::Lifecycle;
#[async_trait]
pub trait Persistency<F: Finitomata>: Send + Sync {
async fn load(
&self,
id: &str,
) -> Result<Option<(Lifecycle, F::State, F::Payload)>, PersistencyError>;
async fn store(
&self,
id: &str,
state: &F::State,
payload: &F::Payload,
) -> Result<(), PersistencyError>;
async fn store_error(
&self,
id: &str,
error: &crate::error::FinitomataError,
) -> Result<(), PersistencyError>;
}