From 7b7cf00cf618e5cd3301989086f97232fb0534ca Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Mon, 25 Feb 2019 12:05:16 -0500 Subject: [PATCH] Updating rust doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Restore from the latest backup Arguments ``` db_dir - A path to the database directory wal_dir - A path to the wal directory opts - Restore options ``` Example ``` ⓘ use rocksdb::backup::{BackupEngine, BackupEngineOptions}; let backup_opts = BackupEngineOptions::default(); let 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()); } ``` --- src/backup.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backup.rs b/src/backup.rs index 0f324bf..78840d6 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -79,10 +79,16 @@ impl BackupEngine { } } /// Restore from the latest backup - /// db_dir: input db directory - /// wal_dir: input wal directory - /// opts: restore options - /// example: + /// + /// # Arguments + /// + /// * `db_dir` - A path to the database directory + /// * `wal_dir` - A path to the wal directory + /// * `opts` - Restore options + /// + /// # Example + /// + /// ```ignore /// use rocksdb::backup::{BackupEngine, BackupEngineOptions}; /// let backup_opts = BackupEngineOptions::default(); /// let backup_engine = BackupEngine::open(&backup_opts, &backup_path).unwrap(); @@ -92,6 +98,7 @@ impl BackupEngine { /// error!("Failed to restore from the backup. Error:{:?}", e); /// return Err(e.to_string()); /// } + /// ``` pub fn restore_from_latest_backup, W: AsRef>( &mut self, db_dir: D,