Updating rust doc

```
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());
 }
```
master
Rohit Joshi 6 years ago committed by GitHub
parent 0a4cedc0a3
commit 7b7cf00cf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/backup.rs

@ -79,10 +79,16 @@ impl BackupEngine {
} }
} }
/// Restore from the latest backup /// Restore from the latest backup
/// db_dir: input db directory ///
/// wal_dir: input wal directory /// # Arguments
/// opts: restore options ///
/// example: /// * `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}; /// use rocksdb::backup::{BackupEngine, BackupEngineOptions};
/// let backup_opts = BackupEngineOptions::default(); /// let backup_opts = BackupEngineOptions::default();
/// let backup_engine = BackupEngine::open(&backup_opts, &backup_path).unwrap(); /// 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); /// error!("Failed to restore from the backup. Error:{:?}", e);
/// return Err(e.to_string()); /// return Err(e.to_string());
/// } /// }
/// ```
pub fn restore_from_latest_backup<D: AsRef<Path>, W: AsRef<Path>>( pub fn restore_from_latest_backup<D: AsRef<Path>, W: AsRef<Path>>(
&mut self, &mut self,
db_dir: D, db_dir: D,

Loading…
Cancel
Save