Interface QuotaBackend.WithResource

  • All Known Subinterfaces:
    QuotaBackend.WithUser
    Enclosing interface:
    QuotaBackend

    public static interface QuotaBackend.WithResource
    An interface capable of issuing quota requests.
    • Method Detail

      • dryRun

        QuotaResponse.Aggregated dryRun​(String quotaGroup,
                                        long tokens)
        Issues a single quota request for numTokens 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 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.