Skip to content

IDurableLog<T> Methods

Represents an append-only, observable log whose entries are recorded in a journal.

Append(T)

abstract
public abstract long Append(T item)
Appends an entry to the log.

Parameters

itemT
The entry.

Returns

The entry's sequence number.

Exceptions

System.InvalidOperationException
The log is sealed.

BeginDraft

abstract
public abstract IDurableLogDraft<T> BeginDraft()
Opens a draft which streams volatile items to readers which include drafts.

Returns

The open draft. Dispose it to abandon the draft unless it was closed.

Exceptions

System.InvalidOperationException
The log is sealed.

Clear

abstract
public abstract void Clear()
Discards every entry, such as to replace the discarded entries with a compacted summary.

Exceptions

System.InvalidOperationException
The log is sealed.

ReadAsync(long, long, bool, LogDraftId?, CancellationToken)

abstract
public abstract IAsyncEnumerable<LogEvent<T>> ReadAsync(long fromSequence = 0, long epoch = 0, bool includeDrafts = false, LogDraftId? resumeDraftId = null, CancellationToken cancellationToken = default(CancellationToken))
Reads the log's committed entries from a position, then waits for new entries.

Parameters

fromSequencelong
The sequence number of the first entry to read.
epochlong
The epoch of the history which fromSequence belongs to, from Orleans.Durable.Journaling.LogEvent.Epoch, or zero to read the current history. When the epoch differs from Orleans.Durable.Journaling.IDurableLog.Epoch, the stream begins with LogEventKind.
includeDraftsbool
Whether the stream also delivers draft events: LogEventKind, LogEventKind, and LogEventKind.
resumeDraftIdLogDraftId?
The draft a reconnecting reader which includes drafts was viewing. When the draft is still open, the stream repeats its items from the beginning. When it committed, the stream reports LogEventKind with the entries which replaced it, in any activation, while the log retains the first of those entries. When it closed in this activation without committing, the stream reports LogEventKind with its LogDraftAbandonReason. Otherwise, the stream reports LogDraftAbandonReason for a draft opened by another activation and LogDraftAbandonReason for a draft of this activation.
cancellationTokenCancellationToken
The token which ends the read.

Returns

A stream of committed entries in sequence order. Each entry is delivered once the journal write which contains it is acknowledged. When includeDrafts is true, the stream also delivers draft items as they are written, and reports a committed draft once the entries which replaced it are durable.

Exceptions

System.ArgumentOutOfRangeException
fromSequence or epoch is negative.
System.InvalidOperationException
Enumeration began before the owning manager recovered its state, or after a failed journal operation stopped it.

Seal

abstract
public abstract void Seal()
Durably ends the log.

TrimBefore(long)

abstract
public abstract void TrimBefore(long sequence)
Discards entries with sequence numbers lower than sequence.

Parameters

sequencelong
The sequence number of the first entry to retain.

Exceptions

System.ArgumentOutOfRangeException
sequence is negative or greater than Orleans.Durable.Journaling.IDurableLog.NextSequence.

TryGet(long, T)

abstract
public abstract bool TryGet(long sequence, out T item)
Attempts to get the retained entry with the specified sequence number.

Parameters

sequencelong
The entry's sequence number.
itemT
The entry, if retained.

Returns

true if the log retains an entry with sequence; otherwise, false.