Unverified Commit 5d330edb authored by Xinye Tao's avatar Xinye Tao Committed by GitHub

add refill_period for creating rate limiter (#526)

Signed-off-by: 's avatartabokie <xy.tao@outlook.com>
parent 5e8633cb
......@@ -991,12 +991,13 @@ impl DBOptions {
pub fn set_ratelimiter_with_auto_tuned(
&mut self,
rate_bytes_per_sec: i64,
refill_period_us: i64,
mode: DBRateLimiterMode,
auto_tuned: bool,
) {
let rate_limiter = RateLimiter::new_with_auto_tuned(
rate_bytes_per_sec,
DEFAULT_REFILL_PERIOD_US,
refill_period_us,
DEFAULT_FAIRNESS,
mode,
auto_tuned,
......
......@@ -171,7 +171,12 @@ fn test_set_ratelimiter_with_auto_tuned() {
let path = tempdir_with_prefix("_rust_rocksdb_test_set_rate_limiter_with_auto_tuned");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.set_ratelimiter_with_auto_tuned(100 * 1024 * 1024, DBRateLimiterMode::AllIo, true);
opts.set_ratelimiter_with_auto_tuned(
100 * 1024 * 1024,
10 * 100000,
DBRateLimiterMode::AllIo,
true
);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
drop(db);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment