Package org.opendaylight.raft.journal
Interface EntryWriter
@NonNullByDefault
public interface EntryWriter
A writer of
RaftJournal
entries.-
Method Summary
Modifier and TypeMethodDescription<T> int
append
(ToByteBufMapper<T> mapper, T entry) Appends an entry to the journal.void
Checkpoints current state so that it can be easily trimmed in the future.void
commit
(long index) Commits entries up to the given index.void
flush()
Flushes written entries to disk.long
Returns the next index to be written.void
reset
(long index) Resets the head of the journal to the given index.
-
Method Details
-
nextIndex
long nextIndex()Returns the next index to be written.- Returns:
- The next index to be written
-
append
Appends an entry to the journal.- Type Parameters:
T
- Internal representation type- Parameters:
mapper
- aToByteBufMapper
to use with entryentry
- entry to append- Returns:
- the on-disk size of the entry
- Throws:
IOException
- if an I/O error occurs
-
commit
void commit(long index) Commits entries up to the given index.- Parameters:
index
- The index up to which to commit entries.
-
reset
void reset(long index) Resets the head of the journal to the given index.- Parameters:
index
- the next index to write- Throws:
IndexOutOfBoundsException
- if the journal cannot be reset to specified index
-
flush
Flushes written entries to disk.- Throws:
IOException
- when an I/O error occurs
-
checkpoint
Checkpoints current state so that it can be easily trimmed in the future.- Throws:
IOException
- when an I/O error occurs
-