private static void updateStatsForSubDirsRemoved(DirIndex dirIndex, Stats stats) {
    stats.filesRemoved += dirIndex.getFilesPresent().size();
    stats.bytesRemoved += dirIndex.getFilesPresent().stream().mapToLong(fi -> fi.getFileMetadata().getSize()).sum();
    for (DirIndex subDirToRemove : dirIndex.getSubDirsPresent()) {
      updateStatsForSubDirsRemoved(subDirToRemove, stats);
    }
  }
Representation of a directory in the blob store
samza-core/src/main/java/org/apache/samza/storage/blobstore/index/DirIndex.java