Package com.apple.foundationdb.record
Interface ByteScanLimiter
Track the number of bytes scanned up to some limit, after which record scans should not be allowed.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the number of bytes that have been scanned thus far.long
getLimit()
Get the byte scan limit.boolean
Atomically check whether the number of remaining bytes is at least 0.boolean
Return whether or not this limiter is actully enforcing the limit (vs one that simply tracks resource consumption).void
registerScannedBytes
(long bytes) Atomically decrement the number of remaining bytes by the given number of bytes.reset()
Create a newByteScanLimiter
with this limiter's original limit, ignoring any calls tohasBytesRemaining()
andregisterScannedBytes(long)
.
-
Method Details
-
reset
Create a newByteScanLimiter
with this limiter's original limit, ignoring any calls tohasBytesRemaining()
andregisterScannedBytes(long)
.- Returns:
- a new
ByteScanLimiter
with this limiter's original limit
-
isEnforcing
boolean isEnforcing()Return whether or not this limiter is actully enforcing the limit (vs one that simply tracks resource consumption).- Returns:
true
if the limiter is enforcing a limit.
-
hasBytesRemaining
boolean hasBytesRemaining()Atomically check whether the number of remaining bytes is at least 0.- Returns:
true
if the remaining count is at least 0 andfalse
if it is less than 0
-
registerScannedBytes
void registerScannedBytes(long bytes) Atomically decrement the number of remaining bytes by the given number of bytes.- Parameters:
bytes
- the number of bytes to register
-
getLimit
long getLimit()Get the byte scan limit. In particular, this will return the target number of bytes that this limiter is being used to enforce.- Returns:
- the byte scan limit being enforced
-
getBytesScanned
long getBytesScanned()Returns the number of bytes that have been scanned thus far.- Returns:
- the number of bytes that have been scanned
-