Package org.opendaylight.raft.journal
Interface EntryWriter
@NonNullByDefault
public interface EntryWriter
A writer of
RaftJournal entries.-
Method Summary
Modifier and TypeMethodDescription<T> intappend(ToByteBufMapper<T> mapper, T entry) Appends an entry to the journal.voidCheckpoints current state so that it can be easily trimmed in the future.voidcommit(long index) Commits entries up to the given index.voidflush()Flushes written entries to disk.longReturns the next index to be written.voidreset(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- aToByteBufMapperto 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
-