Class ScannerContext

java.lang.Object
org.apache.hadoop.hbase.regionserver.ScannerContext
Direct Known Subclasses:
NoLimitScannerContext

@LimitedPrivate("Coprocesssor") @Evolving public class ScannerContext extends Object
ScannerContext instances encapsulate limit tracking AND progress towards those limits during invocations of InternalScanner.next(java.util.List) and InternalScanner.next(java.util.List).

A ScannerContext instance should be updated periodically throughout execution whenever progress towards a limit has been made. Each limit can be checked via the appropriate checkLimit method.

Once a limit has been reached, the scan will stop. The invoker of InternalScanner.next(java.util.List) or InternalScanner.next(java.util.List) can use the appropriate check*Limit methods to see exactly which limits have been reached. Alternatively, checkAnyLimitReached(LimitScope) is provided to see if ANY limit was reached

NoLimitScannerContext.NO_LIMIT is an immutable static definition that can be used whenever a ScannerContext is needed but limits do not need to be enforced.

NOTE: It is important that this class only ever expose setter methods that can be safely skipped when limits should be NOT enforced. This is because of the necessary immutability of the class NoLimitScannerContext. If a setter cannot be safely skipped, the immutable nature of NoLimitScannerContext will lead to incorrect behavior.