GenericSnapshotManager

Struct GenericSnapshotManager 

Source
pub struct GenericSnapshotManager<T: SnapshotTarget> { /* private fields */ }
Expand description

Generic snapshot manager that works with any SnapshotTarget

Implementations§

Source§

impl<T: SnapshotTarget> GenericSnapshotManager<T>

Source

pub fn new(base_dir: PathBuf) -> Self

Source

pub fn save( &self, target: &T, trigger: SnapshotTrigger, message: Option<&str>, profiles_affected: &[String], ) -> Result<Snapshot>

Save a snapshot of the target

Source

pub fn list(&self, target: &T) -> Result<Vec<Snapshot>>

List all snapshots for a target

Source

pub fn get(&self, target: &T, id: &str) -> Result<Snapshot>

Get a specific snapshot

Source

pub fn restore(&self, target: &T, id: &str) -> Result<(usize, usize)>

Restore a snapshot

Source

pub fn diff(&self, target: &T, id: &str) -> Result<SnapshotDiff>

Compare snapshot with current state

Source

pub fn delete(&self, target: &T, id: &str) -> Result<()>

Delete a snapshot

Source

pub fn prune(&self, target: &T, keep: usize) -> Result<Vec<String>>

Prune old snapshots, keeping only the most recent keep snapshots

Source

pub fn latest(&self, target: &T) -> Result<Option<Snapshot>>

Get the latest snapshot

Source§

impl GenericSnapshotManager<TargetDir>

Source

pub fn save_target( &self, target: &Path, trigger: SnapshotTrigger, message: Option<&str>, profiles_affected: &[String], ) -> Result<Snapshot>

Save a snapshot of a target directory

Source

pub fn list_target(&self, target: &Path) -> Result<Vec<Snapshot>>

List snapshots for a target directory

Source

pub fn get_target(&self, target: &Path, id: &str) -> Result<Snapshot>

Get a specific snapshot for a target directory

Source

pub fn restore_target(&self, target: &Path, id: &str) -> Result<(usize, usize)>

Restore a snapshot to a target directory

Source

pub fn diff_target(&self, target: &Path, id: &str) -> Result<SnapshotDiff>

Compare snapshot with current target state

Source

pub fn delete_target(&self, target: &Path, id: &str) -> Result<()>

Delete a snapshot for a target directory

Source

pub fn prune_target(&self, target: &Path, keep: usize) -> Result<Vec<String>>

Prune old snapshots for a target directory

Source§

impl GenericSnapshotManager<ProfileDir>

Source

pub fn save_profile( &self, profile_name: &str, profile_path: &Path, message: Option<&str>, ) -> Result<Snapshot>

Save a snapshot of a profile

Source

pub fn list_profile(&self, profile_name: &str) -> Result<Vec<Snapshot>>

List snapshots for a profile

Source

pub fn get_profile(&self, profile_name: &str, id: &str) -> Result<Snapshot>

Get a specific snapshot for a profile

Source

pub fn restore_profile( &self, profile_name: &str, profile_path: &Path, id: &str, ) -> Result<(usize, usize)>

Restore a snapshot to a profile directory

Source

pub fn diff_profile( &self, profile_name: &str, profile_path: &Path, id: &str, ) -> Result<SnapshotDiff>

Compare snapshot with current profile state

Source

pub fn delete_profile(&self, profile_name: &str, id: &str) -> Result<()>

Delete a snapshot for a profile

Source

pub fn prune_profile( &self, profile_name: &str, keep: usize, ) -> Result<Vec<String>>

Prune old snapshots for a profile

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> Same for T

Source§

type Output = T

Should always be Self
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.