diff --git a/src/backup.rs b/src/backup.rs
index 4106818..0b85bc7 100644
--- a/src/backup.rs
+++ b/src/backup.rs
@@ -78,7 +78,7 @@ impl BackupEngine {
Ok(())
}
}
-
+
/// Restore from the latest backup
///
/// # Arguments
@@ -92,7 +92,7 @@ impl BackupEngine {
/// ```ignore
/// use rocksdb::backup::{BackupEngine, BackupEngineOptions};
/// let backup_opts = BackupEngineOptions::default();
- /// let backup_engine = BackupEngine::open(&backup_opts, &backup_path).unwrap();
+ /// 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) {
@@ -201,3 +201,42 @@ impl Drop for RestoreOptions {
}
}
}
+
+#[test]
+fn backup_restore() {
+
+ use db::DBVector;
+ // create backup
+ let path = "_rust_rocksdb_backup_restore_test";
+ {
+ let db = DB::open_default(path).unwrap();
+ let p = db.put(b"k1", b"v1111");
+ assert!(p.is_ok());
+ let r: Result