private int compactContainer(short containerId, short accountId, String partitionPath) throws CloudStorageException {
    int totalPurged = 0;
    while (!isShuttingDown()) {
      List<CloudBlobMetadata> blobs = requestAgent.doWithRetries(() -> {
        try {
          return cosmosDataAccessor.getContainerBlobsAsync(partitionPath, accountId, containerId, queryLimit).join();
        } catch (CompletionException e) {
          throw toCloudStorageException(
              "Error getting blobs for container " + accountId + " and container " + containerId,
              Utils.extractFutureExceptionCause(e), azureMetrics);
        }
      }, "GetDeprecatedContainerBlobs", partitionPath);

      if (blobs.isEmpty()) {
        // this means all the blobs of this container have been purged from the partition
        updateCompactionProgress(containerId, accountId, partitionPath);
        break;
      }
      if (isShuttingDown()) {
        break;
      }
      totalPurged += requestAgent.doWithRetries(
          () -> AzureCompactionUtil.purgeBlobs(blobs, azureBlobDataAccessor, azureMetrics, cosmosDataAccessor),
          "PurgeBlobs", partitionPath);
      vcrMetrics.deprecatedContainerBlobCompactionRate.mark(blobs.size());
    }
    return totalPurged;
  }
Purge all blobs of the specified container from the specified partition.
@param containerId container id of the specified container.
@param accountId account oid of the specified container.
@param partitionPath partition id from which the blobs have to be deleted.
@return number of blobs purged.
@throws CloudStorageException in case of any error.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/AzureContainerCompactor.java