void addEntry(Offset offset, StoreKey key, Long crc) {
    if (key == null || offset == null) {
      throw new IllegalArgumentException("Invalid arguments passed to add to the journal");
    }
    if (maxEntriesToJournal > 0) {
      if (!inBootstrapMode && currentNumberOfEntries.get() >= maxEntriesToJournal) {
        Map.Entry<Offset, StoreKey> earliestEntry = journal.firstEntry();
        journal.remove(earliestEntry.getKey());
        recentCrcs.remove(earliestEntry.getValue());
        currentNumberOfEntries.decrementAndGet();
      }
      journal.put(offset, key);
      if (crc != null) {
        recentCrcs.put(key, crc);
      }
      logger.trace("Journal : {} offset {} key {}", dataDir, offset, key);
      currentNumberOfEntries.incrementAndGet();
      logger.trace("Journal : {} number of entries {}", dataDir, currentNumberOfEntries.get());
    }
  }
Adds an entry into the journal with the given {@link Offset}, {@link StoreKey}, and crc.
@param offset The {@link Offset} that the key pertains to.
@param key The key that the entry in the journal refers to.
@param crc The crc of the object. This may be null if crc is not available.
ambry-store/src/main/java/com/github/ambry/store/Journal.java