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
ConstructorsModifierConstructorDescriptionprotectedJournalEntry(long index, long term, CompressionType compression) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract MoreObjects.ToStringHelperfinal longindex()Returns the index of the entry.protected abstract InputStreamOpen a newInputStreamcontaining this entry's command in its serialized form as stored in the journal, i.e. compressed withcompression.final InputStreamReturns anInputStreamcontaining this entry's command in its serialized form.final longterm()Returns the term of the entry.final LogEntrytoLogEntry(RestrictedObjectStreams objectStreams) Convert thisEntryJournal.JournalEntryinto aLogEntryby interpretingopenCommandStream()as a stream comtainingLogEntry.command()serialized via Java serialization of itsStateMachineCommand.toSerialForm().final StringtoString()
-
Constructor Details
-
JournalEntry
-
-
Method Details
-
index
public final long index()Description copied from interface:EntryMetaReturns the index of the entry. -
term
public final long term()Description copied from interface:EntryMetaReturns the term of the entry. -
openCommandStream
Returns anInputStreamcontaining this entry's command in its serialized form.- Returns:
- an
InputStream - Throws:
IOException- if an I/O error occurs
-
newCommandStream
Open a newInputStreamcontaining 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.JournalEntryinto aLogEntryby interpretingopenCommandStream()as a stream comtainingLogEntry.command()serialized via Java serialization of itsStateMachineCommand.toSerialForm().- Parameters:
objectStreams- theRestrictedObjectStreamscontext- Returns:
- the
LogEntryequivalent - 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
-