public static interface QuotaBackend.WithResource
Modifier and Type | Method and Description |
---|---|
QuotaResponse.Aggregated |
availableTokens(java.lang.String quotaGroup)
Requests a minimum number of tokens available in implementations.
|
QuotaResponse.Aggregated |
dryRun(java.lang.String quotaGroup,
long tokens)
Issues a single quota request for
numTokens tokens but signals the implementations
not to deduct any quota yet. |
default QuotaResponse.Aggregated |
requestToken(java.lang.String quotaGroup)
Issues a single quota request for
1 token. |
QuotaResponse.Aggregated |
requestTokens(java.lang.String quotaGroup,
long numTokens)
Issues a single quota request for
numTokens tokens. |
default QuotaResponse.Aggregated requestToken(java.lang.String quotaGroup)
1
token.QuotaResponse.Aggregated requestTokens(java.lang.String quotaGroup, long numTokens)
numTokens
tokens.QuotaResponse.Aggregated dryRun(java.lang.String quotaGroup, long tokens)
numTokens
tokens but signals the implementations
not to deduct any quota yet. Can be used to do pre-flight requests where necessaryQuotaResponse.Aggregated availableTokens(java.lang.String quotaGroup)
By definition, this is not an allocating request, therefore, it should be followed by the
call to requestTokens(String, long)
when the size gets determined so that quota
could be properly adjusted. It is in developer discretion to ensure that it gets called.
There might be a case when particular quota gets temporarily overbooked when multiple
requests are performed but the following calls to requestTokens(String, long)
will
fail at the moment when a quota is exhausted. It is not a subject of quota backend to reclaim
tokens that were used due to overbooking.