Interface ByteScanLimiter


@API(INTERNAL) public 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 Type
    Method
    Description
    long
    Returns the number of bytes that have been scanned thus far.
    long
    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
    Atomically decrement the number of remaining bytes by the given number of bytes.
    Create a new ByteScanLimiter with this limiter's original limit, ignoring any calls to hasBytesRemaining() and registerScannedBytes(long).
  • Method Details

    • reset

      @Nonnull ByteScanLimiter reset()
      Create a new ByteScanLimiter with this limiter's original limit, ignoring any calls to hasBytesRemaining() and registerScannedBytes(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 and false 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