private static void addFilesAndBlobsForSubDir(DirIndex dirIndex,
      Set<FileIndex> filesAdded, Set<FileIndex> filesRemoved,
      Set<FileBlob> blobsAdded, Set<FileBlob> blobsRemoved) {
    for (FileIndex filePresent: dirIndex.getFilesPresent()) {
      filesAdded.add(filePresent);
      blobsAdded.addAll(filePresent.getBlobs());
    }

    for (DirIndex subDir: dirIndex.getSubDirsPresent()) {
      addFilesAndBlobsForSubDir(subDir, filesAdded, filesRemoved, blobsAdded, blobsRemoved);
    }

    for (DirIndex subDir: dirIndex.getSubDirsRemoved()) {
      addFilesAndBlobsForSubDirRemoved(subDir, filesRemoved, blobsRemoved);
    }
  }
Representation of a directory in the blob store
samza-core/src/main/java/org/apache/samza/storage/blobstore/index/DirIndex.java