Struct server_forge::rollback::RollbackManager

source ·
pub struct RollbackManager { /* private fields */ }
Expand description

Manages the creation of snapshots and rollback operations.

Implementations§

source§

impl RollbackManager

source

pub fn new() -> Self

Creates a new RollbackManager instance.

source

pub fn create_snapshot(&self) -> Result<usize, Box<dyn Error>>

Creates a new snapshot and returns its ID.

§Errors

Returns an error if the snapshot creation fails.

source

pub fn add_file_change( &self, snapshot_id: usize, file_path: &str, ) -> Result<(), Box<dyn Error>>

Adds a file change to a specific snapshot.

§Arguments
  • snapshot_id - The ID of the snapshot to add the file change to
  • file_path - The path of the changed file
§Errors

Returns an error if reading the file fails or if the snapshot ID is invalid.

source

pub fn add_package_installed( &self, snapshot_id: usize, package: &str, ) -> Result<(), Box<dyn Error>>

Adds an installed package to a specific snapshot.

§Arguments
  • snapshot_id - The ID of the snapshot to add the package to
  • package - The name of the installed package
§Errors

Returns an error if the snapshot ID is invalid.

source

pub fn commit_snapshot(&self, _snapshot_id: usize) -> Result<(), Box<dyn Error>>

Commits a snapshot, finalizing its state.

This method is a placeholder and currently does nothing. It could be expanded to compress the snapshot or write it to disk.

§Arguments
  • _snapshot_id - The ID of the snapshot to commit
source

pub fn rollback_all(&self) -> Result<(), Box<dyn Error>>

Rolls back all changes made since the first snapshot.

§Errors

Returns an error if any part of the rollback process fails.

source

pub fn rollback_to(&self, snapshot_id: usize) -> Result<(), Box<dyn Error>>

Rolls back changes to a specific snapshot.

§Arguments
  • snapshot_id - The ID of the snapshot to roll back to
§Errors

Returns an error if the snapshot ID is invalid or if any part of the rollback process fails.

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>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> UnsafeAny for T
where T: Any,