Package io.atomix.storage.journal
Interface Journal<E>
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SegmentedJournal
Journal.
- Author:
- Jordan Halterman
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcompact(long index) Compacts the journal up to the given index.longReturn the index of the first entry in the journal.longReturn the index of the last entry in the journal.default JournalReader<E>openReader(long index) Opens a new journal reader withJournalReader.Mode.ALL.openReader(long index, JournalReader.Mode mode) Opens a new journal reader with specified mode.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
JournalWriter<E> writer()Returns the journal writer.- Returns:
- The journal writer.
-
openReader
Opens a new journal reader withJournalReader.Mode.ALL.- Parameters:
index- The index at which to start the reader.- Returns:
- A new journal reader.
-
openReader
Opens a new journal reader with specified mode.- Parameters:
index- The index at which to start the reader.mode- the reader mode- 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:
closein interfaceAutoCloseable
-