Show / Hide Table of Contents

Interface IAuditTrail

Represents audit trail responsible for maintaining log entries.

Namespace: DotNext.IO.Log
Assembly: DotNext.IO.dll
Syntax
public interface IAuditTrail

Properties

| Edit this page View Source

IsLogEntryLengthAlwaysPresented

Gets a value indicating that the length of the log entries obtained from this audit trail is always not null.

Declaration
bool IsLogEntryLengthAlwaysPresented { get; }
Property Value
Type Description
bool
| Edit this page View Source

LastCommittedEntryIndex

Gets the index of the last committed log entry.

Declaration
long LastCommittedEntryIndex { get; }
Property Value
Type Description
long
| Edit this page View Source

LastEntryIndex

Gets the index of the last added log entry (committed or not).

Declaration
long LastEntryIndex { get; }
Property Value
Type Description
long

Methods

| Edit this page View Source

CommitAsync(long, CancellationToken)

Commits log entries into the underlying storage and marks these entries as committed.

Declaration
ValueTask<long> CommitAsync(long endIndex, CancellationToken token = default)
Parameters
Type Name Description
long endIndex

The index of the last entry to commit, inclusively.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<long>

The actual number of committed entries.

Remarks

This method should update cached value provided by method LastCommittedEntryIndex called with argument of value true. Additionally, it may force log compaction and squash all committed entries into the single entry called snapshot.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

InitializeAsync(CancellationToken)

Initializes audit trail.

Declaration
Task InitializeAsync(CancellationToken token = default)
Parameters
Type Name Description
CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task

A task representing state of asynchronous execution.

Remarks

This action may perform cache initialization or other internal data structures. It can save the performance of the first modification performed to this log.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

ReadAsync<TResult>(ILogEntryConsumer<ILogEntry, TResult>, long, long, CancellationToken)

Gets log entries in the specified range.

Declaration
ValueTask<TResult> ReadAsync<TResult>(ILogEntryConsumer<ILogEntry, TResult> reader, long startIndex, long endIndex, CancellationToken token = default)
Parameters
Type Name Description
ILogEntryConsumer<ILogEntry, TResult> reader

The reader of the log entries.

long startIndex

The index of the first requested log entry, inclusively.

long endIndex

The index of the last requested log entry, inclusively.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The collection of log entries.

Type Parameters
Name Description
TResult

The type of the result.

Remarks

This method may return fewer entries than endIndex - startIndex + 1. It may happen if the requested entries are committed entries and squashed into the single entry called snapshot. In this case the first entry in the collection is a snapshot entry. Additionally, the caller must call Dispose() to release resources associated with the audit trail segment with entries.

Exceptions
Type Condition
ArgumentOutOfRangeException

startIndex or endIndex is negative.

IndexOutOfRangeException

endIndex is greater than the index of the last added entry.

OperationCanceledException

The operation has been canceled.

See Also
IsSnapshot
| Edit this page View Source

WaitForApplyAsync(long, CancellationToken)

Waits for the entry to be applied to the underlying state machine.

Declaration
ValueTask WaitForApplyAsync(long index, CancellationToken token = default)
Parameters
Type Name Description
long index

The index of the log record to be applied.

CancellationToken token

The token that can be used to cancel waiting.

Returns
Type Description
ValueTask

The task representing asynchronous result.

Exceptions
Type Condition
ArgumentOutOfRangeException

index is less than 1.

OperationCanceledException

The operation has been canceled.

| Edit this page View Source

WaitForApplyAsync(CancellationToken)

Waits for the entry to be applied to the underlying state machine.

Declaration
ValueTask WaitForApplyAsync(CancellationToken token = default)
Parameters
Type Name Description
CancellationToken token

The token that can be used to cancel waiting.

Returns
Type Description
ValueTask

The task representing asynchronous result.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾