private Map<Short, Map<Short, ContainerStorageStats>> getContainerStorageStats(long deleteReferenceTimeInMs,
      long expiryReferenceTimeInMs, DeleteTombstoneStats.Builder builder) {
    Map<Short, Map<Short, ContainerStorageStats>> containerStorageStats = new HashMap<>();
    Map<Short, Map<Short, Long>> validSizeMap = new HashMap<>();
    Map<Short, Map<Short, Long>> physicalSizeMap = new HashMap<>();
    Map<Short, Map<Short, Set<StoreKey>>> storeKeyMap = new HashMap<>();
    Pair<Set<MockId>, Set<MockId>> expiredDeletes = new Pair<>(new HashSet<>(), new HashSet<>());
    for (Offset indSegStartOffset : state.referenceIndex.keySet()) {
      state.getValidIndexEntriesForIndexSegment(indSegStartOffset, deleteReferenceTimeInMs, expiryReferenceTimeInMs,
          null, builder, expiredDeletes, true, (entry, isValid) -> {
            IndexValue indexValue = entry.getValue();
            if (indexValue.isPut() && isValid) {
              StatsUtils.updateNestedMapHelper(validSizeMap, indexValue.getAccountId(), indexValue.getContainerId(),
                  indexValue.getSize());
            }
            StatsUtils.updateNestedMapHelper(physicalSizeMap, indexValue.getAccountId(), indexValue.getContainerId(),
                indexValue.getSize());
            storeKeyMap.computeIfAbsent(indexValue.getAccountId(), k -> new HashMap<>())
                .computeIfAbsent(indexValue.getContainerId(), k -> new HashSet<>())
                .add(entry.getKey());
          });
    }
    for (short accountId : validSizeMap.keySet()) {
      for (short containerId : validSizeMap.get(accountId).keySet()) {
        containerStorageStats.computeIfAbsent(accountId, k -> new HashMap<>())
            .put(containerId, new ContainerStorageStats(containerId, validSizeMap.get(accountId).get(containerId),
                physicalSizeMap.get(accountId).get(containerId), storeKeyMap.get(accountId).get(containerId).size()));
      }
    }
    return containerStorageStats;
  }
Go over the referenceIndex to collect valid data size information per container. The result is used for
verification purposes.
@param deleteReferenceTimeInMs the reference time in ms until which deletes are relevant
@param expiryReferenceTimeInMs the reference time in ms until which expirations are relevant
@param builder a builder that tracks stats related delete tombstones in log segments.
@return a nested {@link Map} of serviceId to containerId to valid data size
ambry-store/src/test/java/com/github/ambry/store/BlobStoreStatsTest.java