use std::sync::Arc;
use async_trait::async_trait;
use crate::graph::state::State;
use super::{error::PersistenceError, snapshot::StateSnapshot};
#[async_trait]
pub trait Checkpointer<S: State>: Send + Sync {
async fn put(
&self,
thread_id: &str,
checkpoint: &StateSnapshot<S>,
) -> Result<String, PersistenceError>;
async fn get(
&self,
thread_id: &str,
checkpoint_id: Option<&str>,
) -> Result<Option<StateSnapshot<S>>, PersistenceError>;
async fn list(
&self,
thread_id: &str,
limit: Option<usize>,
) -> Result<Vec<StateSnapshot<S>>, PersistenceError>;
}
pub type CheckpointerBox<S> = Arc<dyn Checkpointer<S>>;