Struct fdb_rl::scan::ByteScanLimiter
source · pub struct ByteScanLimiter {
limiter_mode: LimiterMode,
limit: usize,
bytes_scanned: Arc<AtomicUsize>,
}
Expand description
Track the number of bytes scanned up to some limit, after which scans should not be allowed.
Fields§
§limiter_mode: LimiterMode
§limit: usize
§bytes_scanned: Arc<AtomicUsize>
Implementations§
source§impl ByteScanLimiter
impl ByteScanLimiter
sourcepub fn enforcing(limit: usize) -> ByteScanLimiter
pub fn enforcing(limit: usize) -> ByteScanLimiter
Create a value of ByteScanLimiter
that enforces a maximum
number of bytes that can be processed in a single scan.
sourcepub fn tracking() -> ByteScanLimiter
pub fn tracking() -> ByteScanLimiter
Create a value of ByteScanLimiter
that tracks the number
of bytes that has been scanned, but does not impose a limit.
sourcepub fn untracked() -> ByteScanLimiter
pub fn untracked() -> ByteScanLimiter
Create a value of ByteScanLimiter
that neither enforces
nor tracks the number of bytes scanned.
sourcepub fn get_scanned_bytes(&self) -> usize
pub fn get_scanned_bytes(&self) -> usize
Returns the number of bytes that have been scanned thus far.
sourcepub fn is_enforcing(&self) -> bool
pub fn is_enforcing(&self) -> bool
Return whether or not this limiter is actually enforcing the limit.
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: In Java RecordLayer, this method is called
hasBytesRemaining
. We are renaming it so that the API is
consistent with KeyValueScanLimiter
and ByteScanLimiter
.
Used by LimitManager::try_keyvalue_scan
(Linking does not work!).
sourcepub(crate) fn register_scanned_bytes(&self, bytes: usize)
pub(crate) fn register_scanned_bytes(&self, bytes: usize)
Increment the number of bytes scanned by the given number of bytes.
Used by LimitManager::register_scanned_bytes
(Linking does not work!).
Trait Implementations§
source§impl Clone for ByteScanLimiter
impl Clone for ByteScanLimiter
source§fn clone(&self) -> ByteScanLimiter
fn clone(&self) -> ByteScanLimiter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more