Skip to main content

VerifyOptions

Struct VerifyOptions 

Source
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: usize

Number 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

Source

pub const fn parallelism(self, workers: usize) -> Self

Sets the number of SSTs to scan concurrently.

Source

pub const fn throttle(self, delay: Duration) -> Self

Sets the per-worker inter-SST throttle delay.

Source

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));
Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifyOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VerifyOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V