@InterfaceAudience.Private @InterfaceStability.Evolving public interface QuotaLimiter
Modifier and Type | Method and Description |
---|---|
void |
addOperationSize(OperationQuota.OperationType type,
long size)
Add the average size of the specified operation type.
|
void |
checkQuota(long estimateWriteSize,
long estimateReadSize)
Checks if it is possible to execute the specified operation.
|
void |
consumeRead(long size)
Removes or add back some read amount to the quota.
|
void |
consumeWrite(long size)
Removes or add back some write amount to the quota.
|
long |
getAvgOperationSize(OperationQuota.OperationType type) |
long |
getReadAvailable() |
long |
getWriteAvailable() |
void |
grabQuota(long writeSize,
long readSize)
Removes the specified write and read amount from the quota.
|
boolean |
isBypass() |
void checkQuota(long estimateWriteSize, long estimateReadSize) throws ThrottlingException
estimateWriteSize
- the write size that will be checked against the available quotaestimateReadSize
- the read size that will be checked against the available quotaThrottlingException
- thrown if not enough avialable resources to perform operation.void grabQuota(long writeSize, long readSize)
writeSize
- the write size that will be removed from the current quotareadSize
- the read size that will be removed from the current quotavoid consumeWrite(long size)
void consumeRead(long size)
boolean isBypass()
long getReadAvailable()
long getWriteAvailable()
void addOperationSize(OperationQuota.OperationType type, long size)
long getAvgOperationSize(OperationQuota.OperationType type)