Class EntryJournal.JournalEntry
java.lang.Object
org.opendaylight.controller.cluster.raft.spi.EntryJournal.JournalEntry
- Enclosing interface:
EntryJournal
public abstract static class EntryJournal.JournalEntry
extends Object
implements EntryMeta, Immutable
A handle to a
LogEntry
stored in the journal. It exposes the entry's EntryMeta
information and
provides access to the serialized form of LogEntry.command()
via openCommandStream()
.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JournalEntry
(long index, long term, CompressionType compression) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract MoreObjects.ToStringHelper
final long
index()
Returns the index of the entry.protected abstract InputStream
Open a newInputStream
containing this entry's command in its serialized form as stored in the journal, i.e. compressed withcompression
.final InputStream
Returns anInputStream
containing this entry's command in its serialized form.final long
term()
Returns the term of the entry.final LogEntry
Convert thisEntryJournal.JournalEntry
into aLogEntry
by interpretingopenCommandStream()
as a stream comtainingLogEntry.command()
serialized via Java serialization of itsStateMachineCommand.toSerialForm()
.final String
toString()
-
Constructor Details
-
JournalEntry
-
-
Method Details
-
index
public final long index()Description copied from interface:EntryMeta
Returns the index of the entry. -
term
public final long term()Description copied from interface:EntryMeta
Returns the term of the entry. -
openCommandStream
Returns anInputStream
containing this entry's command in its serialized form.- Returns:
- an
InputStream
- Throws:
IOException
- if an I/O error occurs
-
newCommandStream
Open a newInputStream
containing this entry's command in its serialized form as stored in the journal, i.e. compressed withcompression
. The returned stream is assumed to buffered.- Returns:
- a buffered
InputStream
- Throws:
IOException
- if an I/O error occurs
-
toLogEntry
Convert thisEntryJournal.JournalEntry
into aLogEntry
by interpretingopenCommandStream()
as a stream comtainingLogEntry.command()
serialized via Java serialization of itsStateMachineCommand.toSerialForm()
.- Returns:
- the
LogEntry
equivalent - Throws:
IOException
- if an I/O error occurs or the corresponding class cannot be resolver
-
toString
-
addToStringAttributes
protected abstract MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper helper) - Parameters:
helper
- theMoreObjects.ToStringHelper
- Returns:
- the
MoreObjects.ToStringHelper
-