Class AtomixLogStorageReader

java.lang.Object
io.camunda.zeebe.broker.logstreams.AtomixLogStorageReader
All Implemented Interfaces:
LogStorageReader, Closeable, AutoCloseable, Iterator<org.agrona.DirectBuffer>

public final class AtomixLogStorageReader extends Object implements LogStorageReader
Implements LogStorageReader over a RaftLogReader. Each ApplicationEntry is considered a block (as per the log storage definition).

The implementation does look-ahead by one entry. This is necessary because we usually want to seek to the entry which contains the given position, and in order to know that it does we need to read it, and only then return it via the next next() call. It is also safe as we read only committed entries, which may be compacted but remain valid.

Note that due to the look-ahead, calling hasNext() may result in doing some I/O and mutating the state of the reader.

The reader currently simply returns the block as is without copying it - this is safe at the moment because the serialization in the underlying RaftLog already copies the data from disk. When switching to zero-copy, however, because of the look-ahead, this reader will have to copy the block. At that point, we may want to look into doing more than a single-step look-ahead (either here or in the LogStreamReader).

  • Constructor Details

    • AtomixLogStorageReader

      public AtomixLogStorageReader(RaftLogReader reader)
  • Method Details