pub struct CheckpointManager<Store: CheckpointStore> { /* private fields */ }Expand description
Main checkpoint manager
Implementations§
Source§impl<Store: CheckpointStore> CheckpointManager<Store>
impl<Store: CheckpointStore> CheckpointManager<Store>
pub fn new(store: Store) -> Self
pub fn with_config(self, config: CheckpointConfig) -> Self
Sourcepub async fn save<S: Serialize + Send>(
&self,
thread_id: &str,
state: &S,
) -> Result<CheckpointId, CheckpointError>
pub async fn save<S: Serialize + Send>( &self, thread_id: &str, state: &S, ) -> Result<CheckpointId, CheckpointError>
Save current state as a checkpoint
Sourcepub async fn save_with_label<S: Serialize + Send>(
&self,
thread_id: &str,
state: &S,
label: Option<String>,
) -> Result<CheckpointId, CheckpointError>
pub async fn save_with_label<S: Serialize + Send>( &self, thread_id: &str, state: &S, label: Option<String>, ) -> Result<CheckpointId, CheckpointError>
Save current state with an optional label
Sourcepub async fn load<S: DeserializeOwned>(
&self,
thread_id: &str,
checkpoint_id: &str,
) -> Result<Checkpoint<S>, CheckpointError>
pub async fn load<S: DeserializeOwned>( &self, thread_id: &str, checkpoint_id: &str, ) -> Result<Checkpoint<S>, CheckpointError>
Load a specific checkpoint
Sourcepub async fn load_latest<S: DeserializeOwned>(
&self,
thread_id: &str,
) -> Result<Checkpoint<S>, CheckpointError>
pub async fn load_latest<S: DeserializeOwned>( &self, thread_id: &str, ) -> Result<Checkpoint<S>, CheckpointError>
Load the latest checkpoint for a thread
Sourcepub async fn history(
&self,
thread_id: &str,
) -> Result<Vec<CheckpointMetadata>, CheckpointError>
pub async fn history( &self, thread_id: &str, ) -> Result<Vec<CheckpointMetadata>, CheckpointError>
Get checkpoint history for a thread
Sourcepub async fn fork<S: Serialize + DeserializeOwned + Send>(
&self,
source_thread_id: &str,
checkpoint_id: &str,
new_thread_id: &str,
) -> Result<CheckpointId, CheckpointError>
pub async fn fork<S: Serialize + DeserializeOwned + Send>( &self, source_thread_id: &str, checkpoint_id: &str, new_thread_id: &str, ) -> Result<CheckpointId, CheckpointError>
Fork from a checkpoint (create a new thread starting from this point)
Sourcepub async fn rewind(
&self,
thread_id: &str,
checkpoint_id: &str,
) -> Result<(), CheckpointError>
pub async fn rewind( &self, thread_id: &str, checkpoint_id: &str, ) -> Result<(), CheckpointError>
Rewind to a previous checkpoint (delete all checkpoints after it)
Sourcepub async fn find_by_tag(
&self,
thread_id: &str,
tag: &str,
) -> Result<Vec<CheckpointMetadata>, CheckpointError>
pub async fn find_by_tag( &self, thread_id: &str, tag: &str, ) -> Result<Vec<CheckpointMetadata>, CheckpointError>
Get checkpoints by tag
Sourcepub async fn find_by_label(
&self,
thread_id: &str,
label: &str,
) -> Result<Option<CheckpointMetadata>, CheckpointError>
pub async fn find_by_label( &self, thread_id: &str, label: &str, ) -> Result<Option<CheckpointMetadata>, CheckpointError>
Get checkpoints by label
Sourcepub async fn delete_thread(
&self,
thread_id: &str,
) -> Result<(), CheckpointError>
pub async fn delete_thread( &self, thread_id: &str, ) -> Result<(), CheckpointError>
Delete a thread and all its checkpoints
Sourcepub fn current_step(&self, thread_id: &str) -> u64
pub fn current_step(&self, thread_id: &str) -> u64
Get current step for a thread
Sourcepub async fn list_threads(&self) -> Result<Vec<ThreadId>, CheckpointError>
pub async fn list_threads(&self) -> Result<Vec<ThreadId>, CheckpointError>
List all threads
Auto Trait Implementations§
impl<Store> !Freeze for CheckpointManager<Store>
impl<Store> !RefUnwindSafe for CheckpointManager<Store>
impl<Store> Send for CheckpointManager<Store>
impl<Store> Sync for CheckpointManager<Store>
impl<Store> Unpin for CheckpointManager<Store>
impl<Store> UnsafeUnpin for CheckpointManager<Store>
impl<Store> UnwindSafe for CheckpointManager<Store>where
Store: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more