Skip to content

IDurableLogCommandCodec<T> Methods

Serializes one durable log command and applies one decoded command.

WriteClear(JournalStreamWriter)

abstract
public abstract void WriteClear(JournalStreamWriter writer)
Writes a command which discards every entry and consumes one sequence number.

Parameters

writerJournalStreamWriter

WriteDraftCommit(LogDraftId, long, ReadOnlySpan<T>, JournalStreamWriter)

abstract
public abstract void WriteDraftCommit(LogDraftId draftId, long sequence, ReadOnlySpan<T> items, JournalStreamWriter writer)
Writes one command which commits a draft by appending items, in order, from sequence.

Parameters

draftIdLogDraftId
sequencelong
itemsReadOnlySpan<T>
writerJournalStreamWriter

WriteSeal(JournalStreamWriter)

abstract
public abstract void WriteSeal(JournalStreamWriter writer)
Writes a command which ends the log.

Parameters

writerJournalStreamWriter

WriteSnapshot(long, long, long, bool, IReadOnlyCollection<T>, IReadOnlyCollection<LogDraftCommit>, JournalStreamWriter)

abstract
public abstract void WriteSnapshot(long epoch, long firstSequence, long resetSequence, bool isSealed, IReadOnlyCollection<T> items, IReadOnlyCollection<LogDraftCommit> draftCommits, JournalStreamWriter writer)
Writes a snapshot command containing the log's state and its retained entries, which begin at firstSequence.

Parameters

epochlong
The identifier of the log's history, or zero when the log has no history.
firstSequencelong
The sequence number of the first retained entry.
resetSequencelong
The first sequence number after the most recent clear, or zero.
isSealedbool
Whether the log is sealed.
itemsIReadOnlyCollection<T>
The retained entries.
draftCommitsIReadOnlyCollection<LogDraftCommit>
The drafts whose committed entries begin at or after firstSequence, in sequence order.
writerJournalStreamWriter
The writer.

WriteTrimBefore(long, JournalStreamWriter)

abstract
public abstract void WriteTrimBefore(long sequence, JournalStreamWriter writer)
Writes a command which discards entries before sequence.

Parameters

sequencelong
writerJournalStreamWriter