@InterfaceAudience.Private @InterfaceStability.Evolving public class TimeBasedLimiter extends Object implements QuotaLimiter
| Modifier and Type | Field and Description |
|---|---|
private static org.apache.hadoop.conf.Configuration |
conf |
private RateLimiter |
readCapacityUnitLimiter |
private RateLimiter |
readReqsLimiter |
private RateLimiter |
readSizeLimiter |
private RateLimiter |
reqCapacityUnitLimiter |
private RateLimiter |
reqSizeLimiter |
private RateLimiter |
reqsLimiter |
private RateLimiter |
writeCapacityUnitLimiter |
private RateLimiter |
writeReqsLimiter |
private RateLimiter |
writeSizeLimiter |
| Modifier | Constructor and Description |
|---|---|
private |
TimeBasedLimiter() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkQuota(long writeReqs,
long estimateWriteSize,
long readReqs,
long estimateReadSize,
long estimateWriteCapacityUnit,
long estimateReadCapacityUnit)
Checks if it is possible to execute the specified operation.
|
void |
consumeRead(long size,
long capacityUnit)
Removes or add back some read amount to the quota.
|
void |
consumeWrite(long size,
long capacityUnit)
Removes or add back some write amount to the quota.
|
(package private) static QuotaLimiter |
fromThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Throttle throttle) |
long |
getReadAvailable() |
long |
getWriteAvailable() |
void |
grabQuota(long writeReqs,
long writeSize,
long readReqs,
long readSize,
long writeCapacityUnit,
long readCapacityUnit)
Removes the specified write and read amount from the quota.
|
boolean |
isBypass() |
private static void |
setFromTimedQuota(RateLimiter limiter,
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota timedQuota) |
String |
toString() |
void |
update(TimeBasedLimiter other) |
private static final org.apache.hadoop.conf.Configuration conf
private RateLimiter reqsLimiter
private RateLimiter reqSizeLimiter
private RateLimiter writeReqsLimiter
private RateLimiter writeSizeLimiter
private RateLimiter readReqsLimiter
private RateLimiter readSizeLimiter
private RateLimiter reqCapacityUnitLimiter
private RateLimiter writeCapacityUnitLimiter
private RateLimiter readCapacityUnitLimiter
private TimeBasedLimiter()
static QuotaLimiter fromThrottle(org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Throttle throttle)
public void update(TimeBasedLimiter other)
private static void setFromTimedQuota(RateLimiter limiter, org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.TimedQuota timedQuota)
public void checkQuota(long writeReqs, long estimateWriteSize, long readReqs, long estimateReadSize, long estimateWriteCapacityUnit, long estimateReadCapacityUnit) throws RpcThrottlingException
QuotaLimitercheckQuota in interface QuotaLimiterwriteReqs - the write requests that will be checked against the available quotaestimateWriteSize - the write size that will be checked against the available quotareadReqs - the read requests that will be checked against the available quotaestimateReadSize - the read size that will be checked against the available quotaestimateWriteCapacityUnit - the write capacity unit that will be checked against the
available quotaestimateReadCapacityUnit - the read capacity unit that will be checked against the
available quotaRpcThrottlingException - thrown if not enough available resources to perform operation.public void grabQuota(long writeReqs, long writeSize, long readReqs, long readSize, long writeCapacityUnit, long readCapacityUnit)
QuotaLimitergrabQuota in interface QuotaLimiterwriteReqs - the write requests that will be removed from the current quotawriteSize - the write size that will be removed from the current quotareadReqs - the read requests that will be removed from the current quotareadSize - the read size that will be removed from the current quotawriteCapacityUnit - the write capacity unit that will be removed from the current quotareadCapacityUnit - the read capacity unit num that will be removed from the current quotapublic void consumeWrite(long size, long capacityUnit)
QuotaLimiterconsumeWrite in interface QuotaLimiterpublic void consumeRead(long size, long capacityUnit)
QuotaLimiterconsumeRead in interface QuotaLimiterpublic boolean isBypass()
isBypass in interface QuotaLimiterpublic long getWriteAvailable()
getWriteAvailable in interface QuotaLimiterpublic long getReadAvailable()
getReadAvailable in interface QuotaLimiterCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.