Interface LogStorageReader

All Superinterfaces:
AutoCloseable, Closeable, Iterator<org.agrona.DirectBuffer>
All Known Implementing Classes:
AtomixLogStorageReader

public interface LogStorageReader extends Iterator<org.agrona.DirectBuffer>, Closeable
The LogStorageReader provides a way to iterate over the blocks that were appended to the log storage via LogStorage.append(long, long, ByteBuffer, AppendListener).

On creation the reader should be positioned such that Iterator.next() would return the first block (assuming there is one).

The expected access pattern is to seek first, then read iteratively by calling Iterator.next().

  • Method Details

    • seek

      void seek(long position)
      Positions the reader such that the next call to Iterator.next() would return a block which contains a LoggedEvent with LoggedEvent.getPosition() equal to the given position, or the highest one which is less than the given position.

      If the position is negative, it should seek to the first position.

      If the position is greater than the greatest position stored, it should seek to the last block, such that Iterator.next() would return that block.

      Parameters:
      position - the position to seek to
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable