Package io.atomix.storage.journal
Class SegmentedJournal<E>
java.lang.Object
io.atomix.storage.journal.SegmentedJournal<E>
- All Implemented Interfaces:
Journal<E>,AutoCloseable
A
Journal implementation based on a RaftJournal.-
Constructor Summary
ConstructorsConstructorDescriptionSegmentedJournal(org.opendaylight.controller.raft.journal.RaftJournal journal, org.opendaylight.controller.raft.journal.FromByteBufMapper<E> readMapper, org.opendaylight.controller.raft.journal.ToByteBufMapper<E> writeMapper) -
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.openReader(long index) Opens a new journal reader withJournalReader.Mode.ALL.openReader(long index, JournalReader.Mode mode) Opens a new journal reader with the given reader mode.toString()writer()Returns the journal writer.
-
Constructor Details
-
SegmentedJournal
-
-
Method Details
-
firstIndex
public long firstIndex()Description copied from interface:JournalReturn the index of the first entry in the journal.- Specified by:
firstIndexin interfaceJournal<E>- Returns:
- the index of the first entry in the journal
-
lastIndex
public long lastIndex()Description copied from interface:JournalReturn the index of the last entry in the journal. -
writer
Description copied from interface:JournalReturns the journal writer. -
openReader
Description copied from interface:JournalOpens a new journal reader withJournalReader.Mode.ALL.- Specified by:
openReaderin interfaceJournal<E>- Parameters:
index- The index at which to start the reader.- Returns:
- A new journal reader.
-
openReader
Opens a new journal reader with the given reader mode.- Specified by:
openReaderin interfaceJournal<E>- Parameters:
index- The index from which to begin reading entries.mode- The mode in which to read entries.- Returns:
- The journal reader.
-
compact
public void compact(long index) Description copied from interface:JournalCompacts the journal up to the given index.The semantics of compaction are not specified by this interface.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceJournal<E>
-
toString
-