From 266571ec5793dc4ab5b524f7fed7c91519aa0fe5 Mon Sep 17 00:00:00 2001 From: Zaidoon Abd Al Hadi <43054535+zaidoon1@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:49:13 -0400 Subject: feat: expose compression option parallel_threads (#828) Co-authored-by: zaidoon --- src/db_options.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/db_options.rs b/src/db_options.rs index 686433b..c3ecc37 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -1041,6 +1041,30 @@ impl Options { } } + /// Number of threads for parallel compression. + /// Parallel compression is enabled only if threads > 1. + /// THE FEATURE IS STILL EXPERIMENTAL + /// + /// See [code](https://github.com/facebook/rocksdb/blob/v8.6.7/include/rocksdb/advanced_options.h#L116-L127) + /// for more information. + /// + /// Default: 1 + /// + /// Examples + /// + /// ``` + /// use rocksdb::{Options, DBCompressionType}; + /// + /// let mut opts = Options::default(); + /// opts.set_compression_type(DBCompressionType::Zstd); + /// opts.set_compression_options_parallel_threads(3); + /// ``` + pub fn set_compression_options_parallel_threads(&mut self, num: i32) { + unsafe { + ffi::rocksdb_options_set_compression_options_parallel_threads(self.inner, num); + } + } + /// Sets the bottom-most compression algorithm that will be used for /// compressing blocks at the bottom-most level. /// -- cgit v1.2.3-70-g09d2