Class AtomixLogStorage
java.lang.Object
io.camunda.zeebe.logstreams.storage.atomix.AtomixLogStorage
- All Implemented Interfaces:
RaftCommitListener,LogStorage
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.logstreams.storage.LogStorage
LogStorage.AppendListener, LogStorage.CommitListener -
Constructor Summary
ConstructorsConstructorDescriptionAtomixLogStorage(AtomixReaderFactory readerFactory, ZeebeLogAppender logAppender) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommitListener(LogStorage.CommitListener listener) Register a commit listenervoidappend(long lowestPosition, long highestPosition, ByteBuffer buffer, LogStorage.AppendListener listener) Writes a block containing one or multiple log entries in the storage and returns the address at which the block has been written.Creates a new reader initialized at the given address.static AtomixLogStorageofPartition(AtomixReaderFactory readerFactory, ZeebeLogAppender appender) voidonCommit(long index) voidRemove a commit listener
-
Constructor Details
-
AtomixLogStorage
-
-
Method Details
-
ofPartition
public static AtomixLogStorage ofPartition(AtomixReaderFactory readerFactory, ZeebeLogAppender appender) -
newReader
Description copied from interface:LogStorageCreates a new reader initialized at the given address.- Specified by:
newReaderin interfaceLogStorage- Returns:
- a new stateful storage reader
-
append
public void append(long lowestPosition, long highestPosition, ByteBuffer buffer, LogStorage.AppendListener listener) Description copied from interface:LogStorageWrites 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:
appendin interfaceLogStorage- Parameters:
lowestPosition- the lowest record position of all records in the block bufferhighestPosition- the highest record position of all records in the block bufferbuffer- the buffer containing a block of log entries to be written into storage
-
addCommitListener
Description copied from interface:LogStorageRegister a commit listener- Specified by:
addCommitListenerin interfaceLogStorage- Parameters:
listener- the listener which will be notified when a new record is committed.
-
removeCommitListener
Description copied from interface:LogStorageRemove a commit listener- Specified by:
removeCommitListenerin interfaceLogStorage- Parameters:
listener- the listener to remove
-
onCommit
public void onCommit(long index) - Specified by:
onCommitin interfaceRaftCommitListener
-