Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,23 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment<Reg
/**
* Returns an RpcQuotaManager that can be used to apply quota checks against the workloads
* generated by the coprocessor.
* <p>
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
* order to take advantage of the new behavior.
* </p>
* @return the RpcQuotaManager
*/
RpcQuotaManager getRpcQuotaManager();
default RpcQuotaManager getRpcQuotaManager() {
throw new UnsupportedOperationException("Not implemented");
}

/**
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
* available quota and to report the data/usage of the operation.
* <p>
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
* order to take advantage of the new behavior.
* </p>
* @param scan the scan to be estimated against the quota
* @param maxBlockBytesScanned the maximum bytes scanned in a single RPC call by the
* scanner
Expand All @@ -150,33 +160,47 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment<Reg
* @return the OperationQuota
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
*/
OperationQuota checkScanQuota(Scan scan, long maxBlockBytesScanned,
long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException;
default OperationQuota checkScanQuota(Scan scan, long maxBlockBytesScanned,
long prevBlockBytesScannedDifference) throws IOException, RpcThrottlingException {
throw new UnsupportedOperationException("Not implemented");
}

/**
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
* available quota and to report the data/usage of the operation. This method does not support
* scans because estimating a scan's workload is more complicated than estimating the workload of
* a get/put.
* <p>
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
* order to take advantage of the new behavior.
* </p>
* @param region the region where the operation will be performed
* @param type the operation type
* @return the OperationQuota
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
*/
OperationQuota checkBatchQuota(final Region region, final OperationQuota.OperationType type)
throws IOException, RpcThrottlingException;
default OperationQuota checkBatchQuota(final Region region,
final OperationQuota.OperationType type) throws IOException, RpcThrottlingException {
throw new UnsupportedOperationException("Not implemented");
}

/**
* Check the quota for the current (rpc-context) user. Returns the OperationQuota used to get the
* available quota and to report the data/usage of the operation. This method does not support
* scans because estimating a scan's workload is more complicated than estimating the workload of
* a get/put.
* <p>
* Introduced in 2.6.1. Any custom implementations of this class should implement this method in
* order to take advantage of the new behavior.
* </p>
* @param region the region where the operation will be performed
* @param numWrites number of writes to count against quota
* @param numReads number of reads to count against quota
* @return the OperationQuota
* @throws RpcThrottlingException if the operation cannot be executed due to quota exceeded.
*/
OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads)
throws IOException, RpcThrottlingException;
default OperationQuota checkBatchQuota(final Region region, int numWrites, int numReads)
throws IOException, RpcThrottlingException {
throw new UnsupportedOperationException("Not implemented");
}
}