pub struct CheckpointService { /* private fields */ }Expand description
Main checkpoint service for integration
Implementations§
Source§impl CheckpointService
impl CheckpointService
Sourcepub fn new(storage: ThreadSafeStorage) -> Self
pub fn new(storage: ThreadSafeStorage) -> Self
Create a new checkpoint service
Initializes the global sequence counter from storage to ensure monotonic sequences across service restarts.
Sourcepub fn global_sequence(&self) -> u64
pub fn global_sequence(&self) -> u64
Get the current global sequence number
Returns the sequence number of the most recently created checkpoint. Returns 0 if no checkpoints have been created yet.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if service is running
Sourcepub fn create_session(&self, _name: &str) -> Result<SessionId>
pub fn create_session(&self, _name: &str) -> Result<SessionId>
Create a new session
Sourcepub fn checkpoint(
&self,
session_id: &SessionId,
message: impl Into<String>,
) -> Result<CheckpointId>
pub fn checkpoint( &self, session_id: &SessionId, message: impl Into<String>, ) -> Result<CheckpointId>
Create a checkpoint with global sequence number
Sourcepub fn list_checkpoints(
&self,
session_id: &SessionId,
) -> Result<Vec<CheckpointSummary>>
pub fn list_checkpoints( &self, session_id: &SessionId, ) -> Result<Vec<CheckpointSummary>>
List checkpoints for a session
Sourcepub fn restore(
&self,
session_id: &SessionId,
checkpoint_id: &CheckpointId,
) -> Result<DebugStateSnapshot>
pub fn restore( &self, session_id: &SessionId, checkpoint_id: &CheckpointId, ) -> Result<DebugStateSnapshot>
Restore a checkpoint
Sourcepub fn enable_auto_checkpoint(
&self,
session_id: &SessionId,
config: AutoCheckpointConfig,
) -> Result<()>
pub fn enable_auto_checkpoint( &self, session_id: &SessionId, config: AutoCheckpointConfig, ) -> Result<()>
Enable auto-checkpointing for a session
Sourcepub fn trigger_auto_checkpoint(
&self,
session_id: &SessionId,
trigger: AutoTrigger,
) -> Result<Option<CheckpointId>>
pub fn trigger_auto_checkpoint( &self, session_id: &SessionId, trigger: AutoTrigger, ) -> Result<Option<CheckpointId>>
Trigger an auto-checkpoint with global sequence
Sourcepub fn subscribe(
&self,
session_id: &SessionId,
) -> Result<Receiver<CheckpointEvent>>
pub fn subscribe( &self, session_id: &SessionId, ) -> Result<Receiver<CheckpointEvent>>
Subscribe to checkpoint events for a session
Sourcepub fn execute(&self, command: CheckpointCommand) -> Result<CommandResult>
pub fn execute(&self, command: CheckpointCommand) -> Result<CommandResult>
Execute a command
Sourcepub fn sync_to_disk(&self) -> Result<()>
pub fn sync_to_disk(&self) -> Result<()>
Sync checkpoints to disk (background persistence)
Sourcepub fn annotate(
&self,
checkpoint_id: &CheckpointId,
annotation: CheckpointAnnotation,
) -> Result<()>
pub fn annotate( &self, checkpoint_id: &CheckpointId, annotation: CheckpointAnnotation, ) -> Result<()>
Annotate a checkpoint
Sourcepub fn get_with_annotations(
&self,
checkpoint_id: &CheckpointId,
) -> Result<AnnotatedCheckpoint>
pub fn get_with_annotations( &self, checkpoint_id: &CheckpointId, ) -> Result<AnnotatedCheckpoint>
Get checkpoint with annotations
Sourcepub fn metrics(&self) -> Result<ServiceMetrics>
pub fn metrics(&self) -> Result<ServiceMetrics>
Get service metrics
Sourcepub fn health_check(&self) -> Result<HealthStatus>
pub fn health_check(&self) -> Result<HealthStatus>
Health check
Sourcepub fn list_by_sequence_range(
&self,
start_seq: u64,
end_seq: u64,
) -> Result<Vec<CheckpointSummary>>
pub fn list_by_sequence_range( &self, start_seq: u64, end_seq: u64, ) -> Result<Vec<CheckpointSummary>>
List checkpoints by global sequence number range
Returns all checkpoints (across all sessions) with sequence numbers in the inclusive range [start_seq, end_seq].
Sourcepub fn export_all_checkpoints(&self) -> Result<String>
pub fn export_all_checkpoints(&self) -> Result<String>
Export all checkpoints from all sessions
Returns a JSON-serializable export containing all checkpoints and the current global sequence number.
Sourcepub fn import_checkpoints(&self, export_data: &str) -> Result<ImportResult>
pub fn import_checkpoints(&self, export_data: &str) -> Result<ImportResult>
Import checkpoints from export data
Imports all checkpoints and restores the global sequence counter. Skips checkpoints that already exist (by ID).
Sourcepub fn validate_checkpoint(&self, checkpoint_id: &CheckpointId) -> Result<bool>
pub fn validate_checkpoint(&self, checkpoint_id: &CheckpointId) -> Result<bool>
Validate a single checkpoint by ID
Returns true if the checkpoint’s checksum is valid, false otherwise.
Sourcepub fn health_check_with_validation(&self) -> Result<HealthStatus>
pub fn health_check_with_validation(&self) -> Result<HealthStatus>
Health check with validation of recent checkpoints
Performs a health check and additionally validates the most recent checkpoints to detect data corruption.
Sourcepub fn validate_all_checkpoints(&self) -> Result<ValidationReport>
pub fn validate_all_checkpoints(&self) -> Result<ValidationReport>
Validate all checkpoints
Performs a full validation of all checkpoints in the system. Returns a report with validation statistics.
Sourcepub async fn get_hypothesis_state(
&self,
checkpoint_id: CheckpointId,
) -> Result<Option<HypothesisState>>
pub async fn get_hypothesis_state( &self, checkpoint_id: CheckpointId, ) -> Result<Option<HypothesisState>>
Get hypothesis state at a specific checkpoint
Auto Trait Implementations§
impl !Freeze for CheckpointService
impl RefUnwindSafe for CheckpointService
impl Send for CheckpointService
impl Sync for CheckpointService
impl Unpin for CheckpointService
impl UnsafeUnpin for CheckpointService
impl UnwindSafe for CheckpointService
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
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>
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>
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