Interface QuotaBackend

All Known Implementing Classes:
DefaultQuotaBackend

public interface QuotaBackend
Backend interface to perform quota requests on. By default, this interface is backed by DefaultQuotaBackend which calls all plugins that implement QuotaEnforcer. A different implementation might be bound in tests. Plugins are not supposed to implement this interface, but bind a QuotaEnforcer 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).