pub struct BackupManager { /* private fields */ }Expand description
Manages backup creation and retention
Implementations§
Source§impl BackupManager
impl BackupManager
Sourcepub fn new(paths: EnvelopePaths, retention: BackupRetention) -> Self
pub fn new(paths: EnvelopePaths, retention: BackupRetention) -> Self
Create a new BackupManager
Sourcepub fn create_backup(&self) -> EnvelopeResult<PathBuf>
pub fn create_backup(&self) -> EnvelopeResult<PathBuf>
Create a backup of all data
Returns the path to the created backup file.
Sourcepub fn list_backups(&self) -> EnvelopeResult<Vec<BackupInfo>>
pub fn list_backups(&self) -> EnvelopeResult<Vec<BackupInfo>>
List all available backups
Sourcepub fn enforce_retention(&self) -> EnvelopeResult<Vec<PathBuf>>
pub fn enforce_retention(&self) -> EnvelopeResult<Vec<PathBuf>>
Enforce retention policy by deleting old backups
Sourcepub fn create_backup_with_retention(
&self,
) -> EnvelopeResult<(PathBuf, Vec<PathBuf>)>
pub fn create_backup_with_retention( &self, ) -> EnvelopeResult<(PathBuf, Vec<PathBuf>)>
Create a backup and then enforce retention policy
Sourcepub fn backup_dir(&self) -> &PathBuf
pub fn backup_dir(&self) -> &PathBuf
Get backup directory path
Sourcepub fn get_backup(&self, filename: &str) -> EnvelopeResult<Option<BackupInfo>>
pub fn get_backup(&self, filename: &str) -> EnvelopeResult<Option<BackupInfo>>
Get a specific backup by filename
Sourcepub fn get_latest_backup(&self) -> EnvelopeResult<Option<BackupInfo>>
pub fn get_latest_backup(&self) -> EnvelopeResult<Option<BackupInfo>>
Get the most recent backup
Auto Trait Implementations§
impl Freeze for BackupManager
impl RefUnwindSafe for BackupManager
impl Send for BackupManager
impl Sync for BackupManager
impl Unpin for BackupManager
impl UnwindSafe for BackupManager
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
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>
Converts
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>
Converts
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