@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultOperationQuota extends Object implements OperationQuota
OperationQuota.AvgOperationSize, OperationQuota.OperationType
Constructor and Description |
---|
DefaultOperationQuota(List<QuotaLimiter> limiters)
NOTE: The order matters.
|
DefaultOperationQuota(QuotaLimiter... limiters) |
Modifier and Type | Method and Description |
---|---|
void |
addGetResult(Result result)
Add a get result.
|
void |
addMutation(Mutation mutation)
Add a mutation result.
|
void |
addScanResult(List<Result> results)
Add a scan result.
|
void |
checkQuota(int numWrites,
int numReads,
int numScans)
Checks if it is possible to execute the specified operation.
|
void |
close()
Cleanup method on operation completion
|
long |
getAvgOperationSize(OperationQuota.OperationType type) |
long |
getReadAvailable() |
long |
getWriteAvailable() |
public DefaultOperationQuota(QuotaLimiter... limiters)
public DefaultOperationQuota(List<QuotaLimiter> limiters)
public void checkQuota(int numWrites, int numReads, int numScans) throws ThrottlingException
OperationQuota
checkQuota
in interface OperationQuota
numWrites
- number of write operation that will be performednumReads
- number of small-read operation that will be performednumScans
- number of long-read operation that will be performedThrottlingException
- if the operation cannot be performedpublic void close()
OperationQuota
close
in interface OperationQuota
public long getReadAvailable()
getReadAvailable
in interface OperationQuota
public long getWriteAvailable()
getWriteAvailable
in interface OperationQuota
public void addGetResult(Result result)
OperationQuota
addGetResult
in interface OperationQuota
public void addScanResult(List<Result> results)
OperationQuota
addScanResult
in interface OperationQuota
public void addMutation(Mutation mutation)
OperationQuota
addMutation
in interface OperationQuota
public long getAvgOperationSize(OperationQuota.OperationType type)
getAvgOperationSize
in interface OperationQuota