Class AtomixLogStorage

java.lang.Object
io.camunda.zeebe.logstreams.storage.atomix.AtomixLogStorage
All Implemented Interfaces:
RaftCommitListener, LogStorage

public class AtomixLogStorage extends Object implements LogStorage, RaftCommitListener
Implementation of LogStorage for the Atomix RaftLog.

Note that this class cannot be made final because we currently spy on it in our tests. This should be changed when the log storage implementation is taken out of this module, at which point it can be made final.

  • Constructor Details

  • Method Details

    • ofPartition

      public static AtomixLogStorage ofPartition(AtomixReaderFactory readerFactory, ZeebeLogAppender appender)
    • newReader

      public AtomixLogStorageReader newReader()
      Description copied from interface: LogStorage
      Creates a new reader initialized at the given address.
      Specified by:
      newReader in interface LogStorage
      Returns:
      a new stateful storage reader
    • append

      public void append(long lowestPosition, long highestPosition, ByteBuffer buffer, LogStorage.AppendListener listener)
      Description copied from interface: LogStorage
      Writes a block containing one or multiple log entries in the storage and returns the address at which the block has been written.

      Storage implementations must guarantee eventually atomicity. When this method completes, either all the bytes must be written or none at all.

      The caller of this method must guarantee that the provided block contains unfragmented log entries.

      Specified by:
      append in interface LogStorage
      Parameters:
      lowestPosition - the lowest record position of all records in the block buffer
      highestPosition - the highest record position of all records in the block buffer
      buffer - the buffer containing a block of log entries to be written into storage
    • addCommitListener

      public void addCommitListener(LogStorage.CommitListener listener)
      Description copied from interface: LogStorage
      Register a commit listener
      Specified by:
      addCommitListener in interface LogStorage
      Parameters:
      listener - the listener which will be notified when a new record is committed.
    • removeCommitListener

      public void removeCommitListener(LogStorage.CommitListener listener)
      Description copied from interface: LogStorage
      Remove a commit listener
      Specified by:
      removeCommitListener in interface LogStorage
      Parameters:
      listener - the listener to remove
    • onCommit

      public void onCommit(long index)
      Specified by:
      onCommit in interface RaftCommitListener