Show / Hide Table of Contents

Interface IAuditTrail<TEntry>

Represents audit trail responsible for maintaining log entries.

Inherited Members
IAuditTrail.GetLastIndex(Boolean)
IAuditTrail.WaitForCommitAsync(Int64, TimeSpan, CancellationToken)
IAuditTrail.WaitForCommitAsync(TimeSpan, CancellationToken)
IAuditTrail.CommitAsync(Int64, CancellationToken)
IAuditTrail.CommitAsync(CancellationToken)
IAuditTrail.CreateBackupAsync(Stream, CancellationToken)
IAuditTrail.InitializeAsync(CancellationToken)
Namespace: DotNext.IO.Log
Assembly: DotNext.IO.dll
Syntax
public interface IAuditTrail<TEntry> : IAuditTrail where TEntry : class, ILogEntry
Type Parameters
Name Description
TEntry

The interface type of the log entry maintained by the audit trail.

Properties

| Improve this Doc View Source

First

Gets the first ephemeral log entry that is present in the empty log.

Declaration
TEntry First { get; }
Property Value
Type Description
TEntry
Remarks

The first log entry always represents NOP database command and is already committed. Index of such entry is always 0.

Methods

| Improve this Doc View Source

AppendAsync<TEntryImpl>(TEntryImpl, Int64)

Adds uncommitted log entry to the end of this log.

Declaration
ValueTask AppendAsync<TEntryImpl>(TEntryImpl entry, long startIndex)

    where TEntryImpl : TEntry
Parameters
Type Name Description
TEntryImpl entry

The uncommitted log entry to be added into this audit trail.

Int64 startIndex

The index from which all previous log entries should be dropped and replaced with the new entry.

Returns
Type Description
ValueTask

The task representing asynchronous state of the method.

Type Parameters
Name Description
TEntryImpl

The actual type of the supplied log entry.

Remarks

This is the only method that can be used for snapshot installation. The behavior of the method depends on the IsSnapshot property. If log entry is a snapshot then the method erases all committed log entries prior to startIndex. If it is not, the method behaves in the same way as AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, Int64, Boolean, CancellationToken).

Exceptions
Type Condition
InvalidOperationException

startIndex is less than the index of the last committed entry and entry is not a snapshot.

| Improve this Doc View Source

AppendAsync<TEntryImpl>(TEntryImpl, CancellationToken)

Adds uncommitted log entry to the end of this log.

Declaration
virtual ValueTask<long> AppendAsync<TEntryImpl>(TEntryImpl entry, CancellationToken token = default(CancellationToken))

    where TEntryImpl : TEntry
Parameters
Type Name Description
TEntryImpl entry

The entry to add.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The index of the added entry.

Type Parameters
Name Description
TEntryImpl

The actual type of the supplied log entry.

Remarks

This method cannot be used to append a snapshot.

Exceptions
Type Condition
InvalidOperationException

entry is the snapshot entry.

| Improve this Doc View Source

AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, Int64, Boolean, CancellationToken)

Adds uncommitted log entries into this log.

Declaration
ValueTask AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl> entries, long startIndex, bool skipCommitted = false, CancellationToken token = default(CancellationToken))

    where TEntryImpl : TEntry
Parameters
Type Name Description
ILogEntryProducer<TEntryImpl> entries

Stateful object that is responsible for supplying log entries.

Int64 startIndex

The index from which all previous log entries should be dropped and replaced with new entries.

Boolean skipCommitted

true to skip committed entries from entries instead of throwing exception.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing asynchronous state of the method.

Type Parameters
Name Description
TEntryImpl

The actual type of the log entry returned by the supplier.

Remarks

The supplying function must return null if it cannot provide more log entries.

Exceptions
Type Condition
InvalidOperationException

startIndex is less than the index of the last committed entry and skipCommitted is false; or the collection of entries contains the snapshot entry.

| Improve this Doc View Source

AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, CancellationToken)

Adds uncommitted log entries to the end of this log.

Declaration
ValueTask<long> AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl> entries, CancellationToken token = default(CancellationToken))

    where TEntryImpl : TEntry
Parameters
Type Name Description
ILogEntryProducer<TEntryImpl> entries

The entries to be added into this log.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The index of the first added entry.

Type Parameters
Name Description
TEntryImpl

The actual type of the log entry returned by the supplier.

Remarks

This method should updates cached value provided by method GetLastIndex(Boolean) called with argument of value false.

Exceptions
Type Condition
ArgumentException

entries is empty.

InvalidOperationException

The collection of entries contains the snapshot entry.

| Improve this Doc View Source

DropAsync(Int64, CancellationToken)

Dropes the uncommitted entries starting from the specified position to the end of the log.

Declaration
ValueTask<long> DropAsync(long startIndex, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Int64 startIndex

The index of the first log entry to be dropped.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The actual number of dropped entries.

Exceptions
Type Condition
InvalidOperationException

startIndex represents index of the committed entry.

| Improve this Doc View Source

ReadAsync<TReader, TResult>(TReader, Int64, Int64, CancellationToken)

Gets log entries in the specified range.

Declaration
ValueTask<TResult> ReadAsync<TReader, TResult>(TReader reader, long startIndex, long endIndex, CancellationToken token = default(CancellationToken))

    where TReader : ILogEntryConsumer<TEntry, TResult>
Parameters
Type Name Description
TReader reader

The reader of the log entries.

Int64 startIndex

The index of the first requested log entry, inclusively.

Int64 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
TReader

The type of the reader.

TResult

The type of the result.

Remarks

This method may return less 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.

See Also
IsSnapshot
| Improve this Doc View Source

ReadAsync<TReader, TResult>(TReader, Int64, CancellationToken)

Gets log entries starting from the specified index to the last log entry.

Declaration
ValueTask<TResult> ReadAsync<TReader, TResult>(TReader reader, long startIndex, CancellationToken token = default(CancellationToken))

    where TReader : ILogEntryConsumer<TEntry, TResult>
Parameters
Type Name Description
TReader reader

The reader of the log entries.

Int64 startIndex

The index of the first 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
TReader

The type of the reader.

TResult

The type of the result.

Exceptions
Type Condition
ArgumentOutOfRangeException

startIndex is negative.

See Also
IsSnapshot

Explicit Interface Implementations

| Improve this Doc View Source

IAuditTrail.ReadAsync<TReader, TResult>(TReader, Int64, Int64, CancellationToken)

Declaration
ValueTask<TResult> IAuditTrail.ReadAsync<TReader, TResult>(TReader reader, long startIndex, long endIndex, CancellationToken token)

    where TReader : ILogEntryConsumer<ILogEntry, TResult>
Parameters
Type Name Description
TReader reader
Int64 startIndex
Int64 endIndex
CancellationToken token
Returns
Type Description
ValueTask<TResult>
Type Parameters
Name Description
TReader
TResult
| Improve this Doc View Source

IAuditTrail.ReadAsync<TReader, TResult>(TReader, Int64, CancellationToken)

Declaration
ValueTask<TResult> IAuditTrail.ReadAsync<TReader, TResult>(TReader reader, long startIndex, CancellationToken token)

    where TReader : ILogEntryConsumer<ILogEntry, TResult>
Parameters
Type Name Description
TReader reader
Int64 startIndex
CancellationToken token
Returns
Type Description
ValueTask<TResult>
Type Parameters
Name Description
TReader
TResult

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX