Package com.google.gerrit.server.quota
Interface QuotaBackend.WithResource
-
- All Known Subinterfaces:
QuotaBackend.WithUser
- Enclosing interface:
- QuotaBackend
public static interface QuotaBackend.WithResource
An interface capable of issuing quota requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description QuotaResponse.Aggregated
availableTokens(String quotaGroup)
Requests a minimum number of tokens available in implementations.QuotaResponse.Aggregated
dryRun(String quotaGroup, long tokens)
Issues a single quota request fornumTokens
tokens but signals the implementations not to deduct any quota yet.default QuotaResponse.Aggregated
requestToken(String quotaGroup)
Issues a single quota request for1
token.QuotaResponse.Aggregated
requestTokens(String quotaGroup, long numTokens)
Issues a single quota request fornumTokens
tokens.
-
-
-
Method Detail
-
requestToken
default QuotaResponse.Aggregated requestToken(String quotaGroup)
Issues a single quota request for1
token.
-
requestTokens
QuotaResponse.Aggregated requestTokens(String quotaGroup, long numTokens)
Issues a single quota request fornumTokens
tokens.
-
dryRun
QuotaResponse.Aggregated dryRun(String quotaGroup, long tokens)
Issues a single quota request fornumTokens
tokens but signals the implementations not to deduct any quota yet. Can be used to do pre-flight requests where necessary
-
availableTokens
QuotaResponse.Aggregated availableTokens(String quotaGroup)
Requests a minimum number of tokens available in implementations. This is a pre-flight check for the exceptional case when the requested number of tokens is not known in advance but boundary can be specified. For instance, when the commit is received its size is not known until the transfer happens however one can specify how many bytes can be accepted to meet the repository size quota.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 torequestTokens(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.
-
-