Interface RaftJournal

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
SegmentedRaftJournal

@NonNullByDefault public interface RaftJournal extends AutoCloseable
A journal of byte arrays. Provides the ability to write modify entries via EntryWriter and read them back via EntryReader.
  • 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

      EntryWriter writer()
      Returns the journal writer.
      Returns:
      The journal writer.
    • openReader

      EntryReader openReader(long index)
      Opens a new EntryReader reading all entries.
      Parameters:
      index - The index at which to start the reader.
      Returns:
      A new journal reader.
    • openCommitsReader

      EntryReader openCommitsReader(long index)
      Opens a new EntryReader reading only committed entries.
      Parameters:
      index - The index at which to start the reader.
      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