boolean getEntriesSince(StoreKey key, FindEntriesCondition findEntriesCondition, List<MessageInfo> entries,
      AtomicLong currentTotalSizeOfEntriesInBytes, boolean inclusive) throws StoreException {
    List<IndexEntry> indexEntries = new ArrayList<>();
    boolean areNewEntriesAdded =
        getIndexEntriesSince(key, findEntriesCondition, indexEntries, currentTotalSizeOfEntriesInBytes, true,
            inclusive);
    for (IndexEntry indexEntry : indexEntries) {
      IndexValue value = indexEntry.getValue();
      MessageInfo info = new MessageInfo(indexEntry.getKey(), value.getSize(), value.isDelete(), value.isTtlUpdate(),
          value.isUndelete(), value.getExpiresAtMs(), null, value.getAccountId(), value.getContainerId(),
          value.getOperationTimeInMs(), value.getLifeVersion());
      entries.add(info);
    }
    return areNewEntriesAdded;
  }
Gets all the entries upto maxEntries from the start of a given key (whether to include this key depends on variable
inclusive) or all entries if key is null, till maxTotalSizeOfEntriesInBytes
@param key The key from where to start retrieving entries.
           If the key is null, all entries are retrieved upto max entries
@param findEntriesCondition The condition that determines when to stop fetching entries.
@param entries The input entries list that needs to be filled. The entries list can have existing entries
@param currentTotalSizeOfEntriesInBytes The current total size in bytes of the entries
@param inclusive whether to include the entry associated with given key in returned result.
@return true if any entries were added.
@throws StoreException
ambry-store/src/main/java/com/github/ambry/store/IndexSegment.java