Package com.google.gerrit.server.quota
Interface QuotaBackend
-
- All Known Implementing Classes:
DefaultQuotaBackend
public interface QuotaBackend
Backend interface to perform quota requests on. By default, this interface is backed byDefaultQuotaBackend
which calls all plugins that implementQuotaEnforcer
. A different implementation might be bound in tests. Plugins are not supposed to implement this interface, but bind aQuotaEnforcer
implementation instead.All quota requests require a quota group and a user. Enriching them with a top-level entity
Change, Project, Account
is optional but should be done if the request is targeted.Example usage:
quotaBackend.currentUser().project(projectName).requestToken("/projects/create").throwOnError(); quotaBackend.user(user).requestToken("/restapi/config/put").throwOnError(); QuotaResponse.Aggregated result = quotaBackend.currentUser().account(accountId).requestToken("/restapi/accounts/emails/validate"); QuotaResponse.Aggregated result = quotaBackend.currentUser().project(projectName).requestTokens("/projects/git/upload", numBytesInPush);
All quota groups must be documented in
quota.txt
and detail the metadata that is provided (i.e. the parameters used to scope down the quota request).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
QuotaBackend.WithResource
An interface capable of issuing quota requests.static interface
QuotaBackend.WithUser
An interface capable of issuing quota requests.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description QuotaBackend.WithUser
currentUser()
Constructs a request for the current user.QuotaBackend.WithUser
user(CurrentUser user)
SeecurrentUser()
.
-
-
-
Method Detail
-
currentUser
QuotaBackend.WithUser currentUser()
Constructs a request for the current user.
-
user
QuotaBackend.WithUser user(CurrentUser user)
SeecurrentUser()
. Use this method only if you can't guarantee that the request is for the current user (e.g. impersonation).
-
-