Skip to main content

BackupManager

Trait BackupManager 

Source
pub trait BackupManager: Send + Sync {
    // Required methods
    fn create_backup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BackupInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rotate_backups<'life0, 'async_trait>(
        &'life0 self,
        max_count: usize,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_backups<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<BackupInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn restore_backup<'life0, 'life1, 'async_trait>(
        &'life0 self,
        backup_path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn maybe_startup_backup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<BackupInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Manages database backup, rotation, and restore.

Required Methods§

Source

fn create_backup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BackupInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a binary backup of the database file, returning backup metadata.

Source

fn rotate_backups<'life0, 'async_trait>( &'life0 self, max_count: usize, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Rotate backups, keeping only the max_count most recent. Returns the number removed.

Source

fn list_backups<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<BackupInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List available backups with path and size.

Source

fn restore_backup<'life0, 'life1, 'async_trait>( &'life0 self, backup_path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore from a backup file. Creates a safety backup of the current DB first.

Source

fn maybe_startup_backup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<BackupInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run automatic startup backup if needed (>24h since last). Returns backup path if created.

Implementors§