Class SegmentedJournal<E>

java.lang.Object
io.atomix.storage.journal.SegmentedJournal<E>
All Implemented Interfaces:
Journal<E>, AutoCloseable

public final class SegmentedJournal<E> extends Object implements Journal<E>
A Journal implementation based on a RaftJournal.
  • Constructor Details

    • SegmentedJournal

      public SegmentedJournal(org.opendaylight.controller.raft.journal.RaftJournal journal, org.opendaylight.controller.raft.journal.FromByteBufMapper<E> readMapper, org.opendaylight.controller.raft.journal.ToByteBufMapper<E> writeMapper)
  • Method Details

    • firstIndex

      public long firstIndex()
      Description copied from interface: Journal
      Return the index of the first entry in the journal.
      Specified by:
      firstIndex in interface Journal<E>
      Returns:
      the index of the first entry in the journal
    • lastIndex

      public long lastIndex()
      Description copied from interface: Journal
      Return the index of the last entry in the journal.
      Specified by:
      lastIndex in interface Journal<E>
      Returns:
      the last index, or zero if there are no entries.
    • writer

      public JournalWriter<E> writer()
      Description copied from interface: Journal
      Returns the journal writer.
      Specified by:
      writer in interface Journal<E>
      Returns:
      The journal writer.
    • openReader

      public JournalReader<E> openReader(long index)
      Description copied from interface: Journal
      Opens a new journal reader with JournalReader.Mode.ALL.
      Specified by:
      openReader in interface Journal<E>
      Parameters:
      index - The index at which to start the reader.
      Returns:
      A new journal reader.
    • openReader

      public JournalReader<E> openReader(long index, JournalReader.Mode mode)
      Opens a new journal reader with the given reader mode.
      Specified by:
      openReader in interface Journal<E>
      Parameters:
      index - The index from which to begin reading entries.
      mode - The mode in which to read entries.
      Returns:
      The journal reader.
    • compact

      public void compact(long index)
      Description copied from interface: Journal
      Compacts the journal up to the given index.

      The semantics of compaction are not specified by this interface.

      Specified by:
      compact in interface Journal<E>
      Parameters:
      index - The index up to which to compact the journal.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Journal<E>
    • toString

      public String toString()
      Overrides:
      toString in class Object