Interface QuotaManager


  • public interface QuotaManager
    Interface for the class that acts as the manager of all the quotas in Ambry. Implementations of this interface should take care of initializing all the various type of quota enforcements and getting the overall quota recommendation for each request.
    • Method Detail

      • getThrottleRecommendation

        ThrottlingRecommendation getThrottleRecommendation​(RestRequest restRequest)
        Computes the overall boolean recommendation to throttle a request or not for all the types of request quotas supported. This method does not charge the requestCost against the quota.
        Parameters:
        restRequest - RestRequest object.
        Returns:
        ThrottlingRecommendation object that captures the overall recommendation.
      • charge

        ThrottlingRecommendation charge​(RestRequest restRequest,
                                        BlobInfo blobInfo,
                                        java.util.Map<QuotaName,​java.lang.Double> requestCostMap)
        Charges the requestCost against the quota for the specified restRequest and blobInfo.
        Parameters:
        restRequest - RestRequest object.
        blobInfo - BlobInfo object representing the blob characteristics using which request cost can be determined by enforcers.
        requestCostMap - Map of QuotaName to the cost incurred to handle the request.
        Returns:
        ThrottlingRecommendation object that captures the overall recommendation.
      • getQuotaConfig

        QuotaConfig getQuotaConfig()
        Returns:
        QuotaConfig object.
      • shutdown

        void shutdown()
        Method to shutdown the QuotaManager and cleanup if required.