@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface QuotaLimiter
| Modifier and Type | Method and Description |
|---|---|
void |
checkQuota(long writeReqs,
long estimateWriteSize,
long readReqs,
long estimateReadSize,
long estimateWriteCapacityUnit,
long estimateReadCapacityUnit,
boolean isAtomic,
long estimateHandlerThreadUsageMs)
Checks if it is possible to execute the specified operation.
|
void |
consumeRead(long size,
long capacityUnit,
boolean isAtomic)
Removes or add back some read amount to the quota.
|
void |
consumeTime(long handlerMillisUsed)
Removes or add back some handler thread usage milliseconds to the quota.
|
void |
consumeWrite(long size,
long capacityUnit,
boolean isAtomic)
Removes or add back some write amount to the quota.
|
long |
getReadAvailable()
Returns the number of bytes available to read to avoid exceeding the quota
|
long |
getReadLimit()
Returns the maximum number of bytes ever available to read
|
long |
getReadNumLimit()
Returns the maximum number of reads to allow per TimeUnit
|
long |
getRequestNumLimit()
Returns the maximum number of requests to allow per TimeUnit
|
long |
getWriteAvailable()
Returns the number of bytes available to write to avoid exceeding the quota
|
long |
getWriteLimit()
Returns the maximum number of bytes ever available to write
|
long |
getWriteNumLimit()
Returns the maximum number of writes to allow per TimeUnit
|
void |
grabQuota(long writeReqs,
long writeSize,
long readReqs,
long readSize,
long writeCapacityUnit,
long readCapacityUnit,
boolean isAtomic,
long estimateHandlerThreadUsageMs)
Removes the specified write and read amount from the quota.
|
boolean |
isBypass()
Returns true if the limiter is a noop
|
void checkQuota(long writeReqs,
long estimateWriteSize,
long readReqs,
long estimateReadSize,
long estimateWriteCapacityUnit,
long estimateReadCapacityUnit,
boolean isAtomic,
long estimateHandlerThreadUsageMs)
throws RpcThrottlingException
writeReqs - 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 quotaisAtomic - if the request performs an atomic operationestimateHandlerThreadUsageMs - the estimated handler usage time in ms that will be checked
against the available quotaRpcThrottlingException - thrown if not enough available resources to perform operation.void grabQuota(long writeReqs,
long writeSize,
long readReqs,
long readSize,
long writeCapacityUnit,
long readCapacityUnit,
boolean isAtomic,
long estimateHandlerThreadUsageMs)
writeReqs - 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 quotaisAtomic - if the request performs an atomic operationestimateHandlerThreadUsageMs - the estimated handler usage time in ms that will be removed
from the available quotavoid consumeWrite(long size,
long capacityUnit,
boolean isAtomic)
void consumeRead(long size,
long capacityUnit,
boolean isAtomic)
void consumeTime(long handlerMillisUsed)
handlerMillisUsed - the actual elapsed time used processing the requestboolean isBypass()
long getReadAvailable()
long getReadLimit()
long getWriteLimit()
long getWriteAvailable()
long getRequestNumLimit()
long getReadNumLimit()
long getWriteNumLimit()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.