long getValidDataSizeForLogSegment(LogSegment segment, long deleteReferenceTimeMs, long expiryReferenceTimeMs,
      FileSpan fileSpanUnderCompaction, DeleteTombstoneStats.Builder builder,
      Pair<Set<MockId>, Set<MockId>> expiredDeletes, boolean invalidateExpiredDelete) {
    List<IndexEntry> validEntries =
        getValidIndexEntriesForLogSegment(segment, deleteReferenceTimeMs, expiryReferenceTimeMs,
            fileSpanUnderCompaction, builder, expiredDeletes, invalidateExpiredDelete);
    long size = 0;
    for (IndexEntry indexEntry : validEntries) {
      size += indexEntry.getValue().getSize();
    }
    return size;
  }
Gets the expected size of the valid data at {@code deleteReferenceTimeMs} in {@code segment}.
@param segment the {@link LogSegment} whose valid size is required.
@param deleteReferenceTimeMs the reference time in ms until which deletes are relevant.
@param expiryReferenceTimeMs the reference time in ms until which expirations are relevant
@param fileSpanUnderCompaction only useful for compaction tests to help determine whether update records will be
                               cleaned up. All other use cases should use {@code null}.
@param builder a builder that tracks stats related delete tombstones in log segments.
@param expiredDeletes a pair of two sets of deletes. The first one contains expired delete tombstones (with no
                      associated PUT); the second one includes expired deletes currently with PUTs ahead of them.
@param invalidateExpiredDelete whether to invalidate the expired delete.
@return the expected size of the valid data at {@code deleteReferenceTimeMs} in {@code segment}.
ambry-store/src/test/java/com/github/ambry/store/CuratedLogIndexState.java