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 TypeMethodDescriptionlongReturns the number of bytes that have been scanned thus far.longgetLimit()Get the byte scan limit.booleanAtomically check whether the number of remaining bytes is at least 0.booleanReturn whether or not this limiter is actully enforcing the limit (vs one that simply tracks resource consumption).voidregisterScannedBytes(long bytes) Atomically decrement the number of remaining bytes by the given number of bytes.reset()Create a newByteScanLimiterwith this limiter's original limit, ignoring any calls tohasBytesRemaining()andregisterScannedBytes(long).
-
Method Details
-
reset
Create a newByteScanLimiterwith this limiter's original limit, ignoring any calls tohasBytesRemaining()andregisterScannedBytes(long).- Returns:
- a new
ByteScanLimiterwith 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:
trueif the limiter is enforcing a limit.
-
hasBytesRemaining
boolean hasBytesRemaining()Atomically check whether the number of remaining bytes is at least 0.- Returns:
trueif the remaining count is at least 0 andfalseif 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
-