pub struct BackupManager { /* private fields */ }Expand description
Backup manager
Implementations§
Source§impl BackupManager
impl BackupManager
Sourcepub fn create_backup(&self, db: &Database, manual: bool) -> Result<PathBuf>
pub fn create_backup(&self, db: &Database, manual: bool) -> Result<PathBuf>
Create a backup
Requires a database reference to perform WAL checkpoint before backup.
Sourcepub fn create_backup_from_path(
&self,
db_path: &Path,
manual: bool,
) -> Result<PathBuf>
pub fn create_backup_from_path( &self, db_path: &Path, manual: bool, ) -> Result<PathBuf>
Create a backup from a raw database file path (DB must be closed)
Unlike create_backup, this does not perform a WAL checkpoint since the
database is expected to be closed.
Sourcepub fn restore_backup(&self, backup_path: &Path, db_path: &Path) -> Result<()>
pub fn restore_backup(&self, backup_path: &Path, db_path: &Path) -> Result<()>
Restore from a backup
Sourcepub fn extract_backup(
&self,
backup_path: &Path,
target_folder: &Path,
) -> Result<PathBuf>
pub fn extract_backup( &self, backup_path: &Path, target_folder: &Path, ) -> Result<PathBuf>
Extract a backup to a folder (for inspection)
Sourcepub fn list_backups(&self) -> Result<Vec<BackupInfo>>
pub fn list_backups(&self) -> Result<Vec<BackupInfo>>
List available backups
Sourcepub fn verify_backup(&self, backup_path: &Path) -> Result<bool>
pub fn verify_backup(&self, backup_path: &Path) -> Result<bool>
Verify a backup file
Sourcepub fn cleanup_old_backups(&self, keep_count: usize) -> Result<usize>
pub fn cleanup_old_backups(&self, keep_count: usize) -> Result<usize>
Clean up old backups, keeping only the specified number
Sourcepub fn get_latest_backup(&self) -> Result<Option<BackupInfo>>
pub fn get_latest_backup(&self) -> Result<Option<BackupInfo>>
Get the latest backup
Sourcepub fn cleanup_auto_backups(
&self,
min_keep: usize,
max_age_days: u32,
) -> Result<usize>
pub fn cleanup_auto_backups( &self, min_keep: usize, max_age_days: u32, ) -> Result<usize>
Clean up old automatic backups based on age
Only deletes automatic backups. Manual and imported backups are never touched.
Keeps at least min_keep auto backups regardless of age.
Deletes auto backups older than max_age_days only if enough newer ones exist.
Returns the number of deleted backups.
Auto Trait Implementations§
impl Freeze for BackupManager
impl RefUnwindSafe for BackupManager
impl Send for BackupManager
impl Sync for BackupManager
impl Unpin for BackupManager
impl UnsafeUnpin 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