@Override
  public StoreBatchDeleteInfo batchDelete(List<MessageInfo> infosToDelete) throws StoreException {
    checkStarted();
    List<MessageInfo> infosToDeleteCopy = new ArrayList<>(infosToDelete);
    checkDuplicates(infosToDelete);
    StoreBatchDeleteInfo storeBatchDeleteInfo = new StoreBatchDeleteInfo(replicaId.getPartitionId(), new ArrayList<>());
    final Timer.Context context = metrics.batchDeleteResponse.time();
    try {
      List<IndexValue> indexValuesPriorToDelete = new ArrayList<>();
      List<IndexValue> originalPuts = new ArrayList<>();
      List<Short> lifeVersions = new ArrayList<>();
      Offset indexEndOffsetBeforeCheck = index.getCurrentEndOffset();
      // Update infosToDelete to filteredInfosToDelete returned from this function.
      infosToDelete = validateAndFilterMessageInfosForBatchDelete(infosToDelete, indexEndOffsetBeforeCheck,
          indexValuesPriorToDelete, lifeVersions, originalPuts, storeBatchDeleteInfo);
      if (infosToDelete.isEmpty()) {
        logger.trace("Batch Delete completely failed since all blobs failed. Received InfosToDelete: {}",
            infosToDeleteCopy);
        return storeBatchDeleteInfo;
      }
      synchronized (storeWriteLock) {
        // Update storeBatchDeleteInfo for the remaining infosToDelete via store lock operations.
        validateAndBatchDelete(infosToDelete, indexEndOffsetBeforeCheck, indexValuesPriorToDelete, lifeVersions,
            originalPuts, storeBatchDeleteInfo, infosToDeleteCopy);
      }
      onSuccess("BATCH_DELETE");
      return storeBatchDeleteInfo;
    } catch (StoreException e) {
      if (e.getErrorCode() == StoreErrorCodes.IOError) {
        onError();
      }
      throw e;
    } catch (Exception e) {
      throw new StoreException("Unknown error while trying to delete blobs from store " + dataDir, e,
          StoreErrorCodes.UnknownError);
    } finally {
      context.stop();
    }
  }
Checks the used capacity of the store against the configured percentage thresholds to see if the store
should be read-only or read-write
ambry-store/src/main/java/com/github/ambry/store/BlobStore.java