Skip to content

Commit

Permalink
Merge branch 'master' into zaidoon/revert-portable-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidoon1 committed Mar 25, 2024
2 parents 6181d0d + 1e45930 commit 21ac7e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ for compatibility. If you need to modify column families concurrently, enable
the crate feature `multi-threaded-cf`, which makes this binding's
data structures use `RwLock` by default. Alternatively, you can directly create
`DBWithThreadMode<MultiThreaded>` without enabling the crate feature.

## Switch between /MT or /MD run time library (Only for Windows)

The feature `mt_static` will request the library to be built with [/MT](https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170)
flag, which results in library using the static version of the run-time library.
*This can be useful in case there's a conflict in the dependecy tree between different
run-time versions.*
4 changes: 4 additions & 0 deletions src/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
7 changes: 7 additions & 0 deletions tests/test_backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,10 @@ fn restore_from_backup() {
}
}
}

fn assert_send_generic<T: Send>() {}

#[test]
fn assert_send() {
assert_send_generic::<BackupEngine>();
}

0 comments on commit 21ac7e2

Please sign in to comment.