Package org.opendaylight.raft.journal
Interface RaftJournal
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SegmentedRaftJournal
A journal of byte arrays. Provides the ability to write modify entries via
EntryWriter
and read them
back via EntryReader
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
compact
(long index) Compacts the journal up to the given index.long
Return the index of the first entry in the journal.long
Return the index of the last entry in the journal.openCommitsReader
(long index) Opens a newEntryReader
reading only committed entries.openReader
(long index) Opens a newEntryReader
reading all entries.writer()
Returns the journal writer.
-
Method Details
-
firstIndex
long firstIndex()Return the index of the first entry in the journal.- Returns:
- the index of the first entry in the journal
-
lastIndex
long lastIndex()Return the index of the last entry in the journal.- Returns:
- the last index, or zero if there are no entries
-
writer
EntryWriter writer()Returns the journal writer.- Returns:
- The journal writer.
-
openReader
Opens a newEntryReader
reading all entries.- Parameters:
index
- The index at which to start the reader.- Returns:
- A new journal reader.
-
openCommitsReader
Opens a newEntryReader
reading only committed entries.- Parameters:
index
- The index at which to start the reader.- Returns:
- A new journal reader.
-
compact
void compact(long index) Compacts the journal up to the given index. The semantics of compaction are not specified by this interface.- Parameters:
index
- The index up to which to compact the journal.
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-