Interface JournalReader<E>

All Superinterfaces:
AutoCloseable

@NonNullByDefault public interface JournalReader<E> extends AutoCloseable
Log reader.
Author:
Jordan Halterman
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A journal entry processor.
    static enum 
    Raft log reader mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    long
    Returns the next reader index.
    void
    Resets the reader to the start.
    void
    reset(long index)
    Resets the reader to the given index.
    <T> @Nullable T
    Try to move to the next entry.
  • Method Details

    • getNextIndex

      long getNextIndex()
      Returns the next reader index.
      Returns:
      The next reader index.
    • tryNext

      <T> @Nullable T tryNext(JournalReader.EntryMapper<E,T> entryMapper)
      Try to move to the next entry.
      Parameters:
      entryMapper - callback to be invoked for the entry
      Returns:
      processed entry, or null
    • reset

      void reset()
      Resets the reader to the start.
    • reset

      void reset(long index)
      Resets the reader to the given index.
      Parameters:
      index - the next index to read
    • close

      void close()
      Specified by:
      close in interface AutoCloseable