Struct rocksdb::backup::BackupEngine [−][src]
pub struct BackupEngine { /* fields omitted */ }
Implementations
impl BackupEngine
[src]
impl BackupEngine
[src]pub fn open<P: AsRef<Path>>(
opts: &BackupEngineOptions,
path: P
) -> Result<BackupEngine, Error>
[src]
opts: &BackupEngineOptions,
path: P
) -> Result<BackupEngine, Error>
Open a backup engine with the specified options.
pub fn create_new_backup(&mut self, db: &DB) -> Result<(), Error>
[src]
Captures the state of the database in the latest backup.
Note: no flush before backup is performed. User might want to
use create_new_backup_flush
instead.
pub fn create_new_backup_flush(
&mut self,
db: &DB,
flush_before_backup: bool
) -> Result<(), Error>
[src]
&mut self,
db: &DB,
flush_before_backup: bool
) -> Result<(), Error>
Captures the state of the database in the latest backup.
Set flush_before_backup=true to avoid losing unflushed key/value pairs from the memtable.
pub fn purge_old_backups(
&mut self,
num_backups_to_keep: usize
) -> Result<(), Error>
[src]
&mut self,
num_backups_to_keep: usize
) -> Result<(), Error>
pub fn restore_from_latest_backup<D: AsRef<Path>, W: AsRef<Path>>(
&mut self,
db_dir: D,
wal_dir: W,
opts: &RestoreOptions
) -> Result<(), Error>
[src]
&mut self,
db_dir: D,
wal_dir: W,
opts: &RestoreOptions
) -> Result<(), Error>
Restore from the latest backup
Arguments
db_dir
- A path to the database directorywal_dir
- A path to the wal directoryopts
- Restore options
Examples
use rocksdb::backup::{BackupEngine, BackupEngineOptions}; let backup_opts = BackupEngineOptions::default(); let mut backup_engine = BackupEngine::open(&backup_opts, &backup_path).unwrap(); let mut restore_option = rocksdb::backup::RestoreOptions::default(); restore_option.set_keep_log_files(true); /// true to keep log files if let Err(e) = backup_engine.restore_from_latest_backup(&db_path, &wal_dir, &restore_option) { error!("Failed to restore from the backup. Error:{:?}", e); return Err(e.to_string()); }
pub fn verify_backup(&self, backup_id: u32) -> Result<(), Error>
[src]
Checks that each file exists and that the size of the file matches our expectations. it does not check file checksum.
If this BackupEngine created the backup, it compares the files’ current sizes against the number of bytes written to them during creation. Otherwise, it compares the files’ current sizes against their sizes when the BackupEngine was opened.
pub fn get_backup_info(&self) -> Vec<BackupEngineInfo>
[src]
Get a list of all backups together with information on timestamp of the backup and the size (please note that sum of all backups’ sizes is bigger than the actual size of the backup directory because some data is shared by multiple backups). Backups are identified by their always-increasing IDs.
You can perform this function safely, even with other BackupEngine performing backups on the same directory
Trait Implementations
impl Drop for BackupEngine
[src]
impl Drop for BackupEngine
[src]