From 0a4cedc0a31db1f2a4e7203c1ac76570b638376d Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Sun, 24 Feb 2019 23:26:14 -0500 Subject: [PATCH 1/2] Specifying two separate Path Replacing single path `P` with `D: AsRef, W: AsRef` --- src/backup.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backup.rs b/src/backup.rs index f53e918..0f324bf 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -92,10 +92,10 @@ impl BackupEngine { /// error!("Failed to restore from the backup. Error:{:?}", e); /// return Err(e.to_string()); /// } - pub fn restore_from_latest_backup>( + pub fn restore_from_latest_backup, W: AsRef>( &mut self, - db_dir: P, - wal_dir: P, + db_dir: D, + wal_dir: W, opts: &RestoreOptions, ) -> Result<(), Error> { let db_dir = db_dir.as_ref(); From 7b7cf00cf618e5cd3301989086f97232fb0534ca Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Mon, 25 Feb 2019 12:05:16 -0500 Subject: [PATCH 2/2] 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,