diff options
-rw-r--r-- | src/backup.rs | 4 | ||||
-rw-r--r-- | tests/test_backup.rs | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/backup.rs b/src/backup.rs index 17d0796..2ad37f9 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -48,6 +48,10 @@ pub struct RestoreOptions { inner: *mut ffi::rocksdb_restore_options_t, } +// BackupEngine is a simple pointer wrapper, so it's safe to send to another thread +// since the underlying RocksDB backup engine is thread-safe. +unsafe impl Send for BackupEngine {} + impl BackupEngine { /// Open a backup engine with the specified options and RocksDB Env. pub fn open(opts: &BackupEngineOptions, env: &Env) -> Result<Self, Error> { diff --git a/tests/test_backup.rs b/tests/test_backup.rs index b1dff2e..5109e52 100644 --- a/tests/test_backup.rs +++ b/tests/test_backup.rs @@ -107,3 +107,10 @@ fn restore_from_backup() { } } } + +fn assert_send_generic<T: Send>() {} + +#[test] +fn assert_send() { + assert_send_generic::<BackupEngine>(); +} |