pub struct BackupManager { /* private fields */ }
Expand description
Backup manager for Things 3 database
Implementations§
Source§impl BackupManager
impl BackupManager
Sourcepub const fn new(config: ThingsConfig) -> Self
pub const fn new(config: ThingsConfig) -> Self
Create a new backup manager
Sourcepub fn create_backup(
&self,
backup_dir: &Path,
description: Option<&str>,
) -> Result<BackupMetadata>
pub fn create_backup( &self, backup_dir: &Path, description: Option<&str>, ) -> Result<BackupMetadata>
Create a backup of the Things 3 database
§Errors
Returns an error if the backup directory cannot be created or if the database file cannot be copied.
Sourcepub fn restore_backup(&self, backup_path: &Path) -> Result<()>
pub fn restore_backup(&self, backup_path: &Path) -> Result<()>
Restore from a backup
§Errors
Returns an error if the backup file doesn’t exist or if copying fails.
Sourcepub fn list_backups(&self, backup_dir: &Path) -> Result<Vec<BackupMetadata>>
pub fn list_backups(&self, backup_dir: &Path) -> Result<Vec<BackupMetadata>>
List available backups in a directory
§Errors
Returns an error if the directory cannot be read or if metadata files are corrupted.
Sourcepub fn get_backup_metadata(&self, backup_path: &Path) -> Result<BackupMetadata>
pub fn get_backup_metadata(&self, backup_path: &Path) -> Result<BackupMetadata>
Get backup metadata from a backup file
§Errors
Returns an error if the metadata file cannot be read or parsed.
Sourcepub fn delete_backup(&self, backup_path: &Path) -> Result<()>
pub fn delete_backup(&self, backup_path: &Path) -> Result<()>
Sourcepub fn cleanup_old_backups(
&self,
backup_dir: &Path,
keep_count: usize,
) -> Result<usize>
pub fn cleanup_old_backups( &self, backup_dir: &Path, keep_count: usize, ) -> Result<usize>
Clean up old backups, keeping only the specified number
§Errors
Returns an error if the directory cannot be read or if files cannot be deleted.
Sourcepub async fn verify_backup(&self, backup_path: &Path) -> Result<bool>
pub async fn verify_backup(&self, backup_path: &Path) -> Result<bool>
Verify a backup by checking if it can be opened
§Errors
Returns an error if the file cannot be accessed or opened.
Sourcepub fn get_backup_stats(&self, backup_dir: &Path) -> Result<BackupStats>
pub fn get_backup_stats(&self, backup_dir: &Path) -> Result<BackupStats>
Get backup statistics
§Errors
Returns an error if the directory cannot be read or if metadata files are corrupted.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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