rmdmattingly commented on code in PR #6066:
URL: https://github.com/apache/hbase/pull/6066#discussion_r1671022670


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java:
##########
@@ -120,4 +124,25 @@ public interface RegionCoprocessorEnvironment extends 
CoprocessorEnvironment<Reg
    * @return the RawCellBuilder
    */
   RawCellBuilder getCellBuilder();
+
+  /**
+   * Returns an RpcQuotaManager that can be used to apply quota checks against 
the workloads
+   * generated by the coprocessor.
+   * @return the RpcQuotaManager
+   */
+  RpcQuotaManager getRpcQuotaManager();
+
+  /**
+   * 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.
+   * @param scan                     the scan to be estimated against the quota
+   * @param maxBlockBytesScanned            the maximum bytes scanned in a 
single RPC call by the
+   *                                        scanner
+   * @param prevBlockBytesScannedDifference the difference between BBS of the 
previous two next
+   *                                        calls
+   * @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;

Review Comment:
   We'll probably want to add support for checking batch quotas as well. I 
guess maybe that can be done trivially via the RpcQuotaManager, but could be 
nice for API consistency maybe?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to