pub struct VerifyOptions {
pub parallelism: usize,
pub throttle: Option<Duration>,
pub rate_limiter: Option<Arc<RateLimiter>>,
}Expand description
Options for the block-checksum scrubber
(verify_block_checksums_with / AbstractTree::verify_checksum_with).
Fields§
§parallelism: usizeNumber of SSTs to scan concurrently. Clamped to >= 1 and to the table
count. 1 (the default) scans sequentially in table order with no
thread spawn. Per-SST scans are independent (each opens its own file
through the table’s Fs handle), so they parallelize cleanly.
throttle: Option<Duration>Minimum delay each worker waits after finishing one SST before taking
the next, capping I/O pressure on a production box during a scrub.
None (default) runs at full speed.
rate_limiter: Option<Arc<RateLimiter>>The budget the scan reads under: every block and raw section is charged
its on-disk bytes before it is read, through this one limiter for all
parallelism workers. Shared, so a caller can
retune it live or draw it from the same budget as compaction. None
(default) reads at full speed. Only a std build waits on it.
The scan reports how long each charged read took, so a limiter with a
LatencyBackoff backs the scan
off while the device is slow to answer. The backoff lowers what the
limiter grants to every holder: on a budget shared with compaction it
slows compaction too, so a scan that should back off alone gets a
limiter of its own.
Implementations§
Source§impl VerifyOptions
impl VerifyOptions
Sourcepub const fn parallelism(self, workers: usize) -> Self
pub const fn parallelism(self, workers: usize) -> Self
Sets the number of SSTs to scan concurrently.
Sourcepub const fn throttle(self, delay: Duration) -> Self
pub const fn throttle(self, delay: Duration) -> Self
Sets the per-worker inter-SST throttle delay.
Sourcepub fn rate_limiter(self, limiter: Arc<RateLimiter>) -> Self
pub fn rate_limiter(self, limiter: Arc<RateLimiter>) -> Self
Reads the scan under limiter (see Self::rate_limiter).
§Examples
use lsm_tree::rate_limiter::RateLimiter;
use lsm_tree::verify::VerifyOptions;
use std::sync::Arc;
// One budget for the scrub and compaction, retuned live.
let budget = Arc::new(RateLimiter::new(64 << 20));
let opts = VerifyOptions::default().rate_limiter(Arc::clone(&budget));
budget.set_rate(16 << 20);
assert_eq!(opts.rate_limiter.map(|l| l.rate()), Some(16 << 20));Sourcepub fn max_bytes_per_sec(self, bytes_per_sec: u64) -> Self
pub fn max_bytes_per_sec(self, bytes_per_sec: u64) -> Self
Reads the scan at no more than bytes_per_sec on-disk bytes per
second, under a limiter of its own; 0 reads at full speed.
Trait Implementations§
Source§impl Clone for VerifyOptions
impl Clone for VerifyOptions
Source§impl Debug for VerifyOptions
impl Debug for VerifyOptions
Auto Trait Implementations§
impl !RefUnwindSafe for VerifyOptions
impl !UnwindSafe for VerifyOptions
impl Freeze for VerifyOptions
impl Send for VerifyOptions
impl Sync for VerifyOptions
impl Unpin for VerifyOptions
impl UnsafeUnpin for VerifyOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more