CheckpointManager

Struct CheckpointManager 

Source
pub struct CheckpointManager { /* private fields */ }
Expand description

Manages checkpoints for rollback operations

Implementations§

Source§

impl CheckpointManager

Source

pub fn new() -> Self

Create a new checkpoint manager

Source

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

Source

pub fn list_checkpoints(&self) -> Vec<Checkpoint>

List all checkpoints

Source

pub fn get_checkpoint( &self, checkpoint_id: &str, ) -> Result<Checkpoint, UndoRedoError>

Get a specific checkpoint by ID

Source

pub fn delete_checkpoint( &mut self, checkpoint_id: &str, ) -> Result<(), UndoRedoError>

Delete a checkpoint by ID

Source

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.

Source

pub fn verify_rollback( &self, checkpoint_id: &str, ) -> Result<bool, UndoRedoError>

Verify rollback success and report errors

Source

pub fn restore_pre_rollback_state( &mut self, pre_rollback_state: HashMap<String, String>, )

Restore the pre-rollback state (used for rollback failure recovery)

Source

pub fn get_current_state(&self) -> HashMap<String, String>

Get the current state

Source

pub fn set_current_state(&mut self, state: HashMap<String, String>)

Set the current state (for testing and initialization)

Source

pub fn checkpoint_count(&self) -> usize

Get the number of checkpoints

Trait Implementations§

Source§

impl Default for CheckpointManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.