Struct fdb_rl::scan::KeyValueScanLimiter
source · pub struct KeyValueScanLimiter {
limiter_mode: LimiterMode,
limit: usize,
keyvalues_scanned: Arc<AtomicUsize>,
}
Expand description
Track the number of keyvalues scanned up to some limit, after which scans should not be allowed.
Fields§
§limiter_mode: LimiterMode
§limit: usize
§keyvalues_scanned: Arc<AtomicUsize>
Implementations§
source§impl KeyValueScanLimiter
impl KeyValueScanLimiter
sourcepub fn enforcing(limit: usize) -> KeyValueScanLimiter
pub fn enforcing(limit: usize) -> KeyValueScanLimiter
Create a value of KeyValueScanLimiter
that enforces a maximum
number of keyvalues that can be processed in a single scan.
sourcepub fn tracking() -> KeyValueScanLimiter
pub fn tracking() -> KeyValueScanLimiter
Create a value of KeyValueScanLimiter
that tracks the
number of keyvalues that has been scanned, but does not impose
a limit.
sourcepub fn untracked() -> KeyValueScanLimiter
pub fn untracked() -> KeyValueScanLimiter
Create a value of KeyValueScanLimiter
that neither
enforces nor tracks the number of keyvalues scanned.
sourcepub fn get_scanned_keyvalues(&self) -> usize
pub fn get_scanned_keyvalues(&self) -> usize
Returns the number of keyvalues that have been scanned thus far.
sourcepub(crate) fn try_keyvalue_scan(&self) -> bool
pub(crate) fn try_keyvalue_scan(&self) -> bool
Return true
if keyvalue can be read otherwise return
false
.
Note: When it returns true
it also increments
keyvalues_scanned
field.
Used by LimitManager::try_keyvalue_scan
(Linking does not work!).
sourcepub fn is_enforcing(&self) -> bool
pub fn is_enforcing(&self) -> bool
Return whether or not this limiter is actually enforcing the limit.
Trait Implementations§
source§impl Clone for KeyValueScanLimiter
impl Clone for KeyValueScanLimiter
source§fn clone(&self) -> KeyValueScanLimiter
fn clone(&self) -> KeyValueScanLimiter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more