@Override
  public QuotaAction checkAndCharge(boolean shouldCheckQuotaExceedAllowed, boolean forceCharge, long chunkSize)
      throws QuotaException {
    Map<QuotaName, Double> requestCost = requestCostPolicy.calculateRequestQuotaCharge(restRequest, chunkSize)
        .entrySet()
        .stream()
        .collect(Collectors.toMap(entry -> QuotaName.valueOf(entry.getKey()), Map.Entry::getValue));
    QuotaAction quotaAction =
        quotaManager.chargeAndRecommend(restRequest, requestCost, shouldCheckQuotaExceedAllowed, forceCharge);
    // Note that we track quota usages even if QuotaMode is TRACKING, so although we return ALLOW, checkAndCharge still
    // needs to happen
    return quotaManager.getQuotaMode() == QuotaMode.TRACKING ? QuotaAction.ALLOW : quotaAction;
  }
Constructor for {@link PreProcessQuotaChargeCallback}.
@param quotaManager {@link QuotaManager} object responsible for charging the quota.
@param restRequest {@link RestRequest} for which quota is being charged.
ambry-quota/src/main/java/com/github/ambry/quota/PreProcessQuotaChargeCallback.java