Interface Journal<E>

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
SegmentedJournal

public interface Journal<E> extends AutoCloseable
Journal.
Author:
Jordan Halterman
  • Method Details

    • firstIndex

      long firstIndex()
      Return the index of the first entry in the journal.
      Returns:
      the index of the first entry in the journal
    • lastIndex

      long lastIndex()
      Return the index of the last entry in the journal.
      Returns:
      the last index, or zero if there are no entries.
    • writer

      JournalWriter<E> writer()
      Returns the journal writer.
      Returns:
      The journal writer.
    • openReader

      default JournalReader<E> openReader(long index)
      Opens a new journal reader with JournalReader.Mode.ALL.
      Parameters:
      index - The index at which to start the reader.
      Returns:
      A new journal reader.
    • openReader

      JournalReader<E> openReader(long index, JournalReader.Mode mode)
      Opens a new journal reader with specified mode.
      Parameters:
      index - The index at which to start the reader.
      mode - the reader mode
      Returns:
      A new journal reader.
    • compact

      void compact(long index)
      Compacts the journal up to the given index.

      The semantics of compaction are not specified by this interface.

      Parameters:
      index - The index up to which to compact the journal.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable