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
Modifier and TypeMethodDescriptionavailableTokens
(String quotaGroup) Requests a minimum number of tokens available in implementations.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.requestTokens
(String quotaGroup, long numTokens) Issues a single quota request fornumTokens
tokens.
-
Method Details
-
requestToken
Issues a single quota request for1
token. -
requestTokens
Issues a single quota request fornumTokens
tokens. -
dryRun
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
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.
-