pub struct CheckpointManager { /* private fields */ }Expand description
Manages checkpoints for rollback operations
Implementations§
Source§impl CheckpointManager
impl CheckpointManager
Sourcepub fn create_checkpoint(
&mut self,
name: impl Into<String>,
description: impl Into<String>,
file_states: HashMap<String, String>,
) -> Result<String, UndoRedoError>
pub fn create_checkpoint( &mut self, name: impl Into<String>, description: impl Into<String>, file_states: HashMap<String, String>, ) -> Result<String, UndoRedoError>
Create a new checkpoint and store it
Sourcepub fn list_checkpoints(&self) -> Vec<Checkpoint>
pub fn list_checkpoints(&self) -> Vec<Checkpoint>
List all checkpoints
Sourcepub fn get_checkpoint(
&self,
checkpoint_id: &str,
) -> Result<Checkpoint, UndoRedoError>
pub fn get_checkpoint( &self, checkpoint_id: &str, ) -> Result<Checkpoint, UndoRedoError>
Get a specific checkpoint by ID
Sourcepub fn delete_checkpoint(
&mut self,
checkpoint_id: &str,
) -> Result<(), UndoRedoError>
pub fn delete_checkpoint( &mut self, checkpoint_id: &str, ) -> Result<(), UndoRedoError>
Delete a checkpoint by ID
Sourcepub fn rollback_to(&mut self, checkpoint_id: &str) -> Result<(), UndoRedoError>
pub fn rollback_to(&mut self, checkpoint_id: &str) -> Result<(), UndoRedoError>
Rollback to a specific checkpoint with atomic guarantees
This operation attempts to restore all files to the checkpoint state. If any file fails to restore, the operation is rolled back to the pre-rollback state. Uses transaction-like semantics: all-or-nothing.
Sourcepub fn verify_rollback(
&self,
checkpoint_id: &str,
) -> Result<bool, UndoRedoError>
pub fn verify_rollback( &self, checkpoint_id: &str, ) -> Result<bool, UndoRedoError>
Verify rollback success and report errors
Sourcepub fn restore_pre_rollback_state(
&mut self,
pre_rollback_state: HashMap<String, String>,
)
pub fn restore_pre_rollback_state( &mut self, pre_rollback_state: HashMap<String, String>, )
Restore the pre-rollback state (used for rollback failure recovery)
Sourcepub fn get_current_state(&self) -> HashMap<String, String>
pub fn get_current_state(&self) -> HashMap<String, String>
Get the current state
Sourcepub fn set_current_state(&mut self, state: HashMap<String, String>)
pub fn set_current_state(&mut self, state: HashMap<String, String>)
Set the current state (for testing and initialization)
Sourcepub fn checkpoint_count(&self) -> usize
pub fn checkpoint_count(&self) -> usize
Get the number of checkpoints
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CheckpointManager
impl RefUnwindSafe for CheckpointManager
impl Send for CheckpointManager
impl Sync for CheckpointManager
impl Unpin for CheckpointManager
impl UnwindSafe for CheckpointManager
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