Class InMemoryAuditTrail
Represents in-memory audit trail for Raft-based cluster node.
Inheritance
InMemoryAuditTrail
Assembly: DotNext.Net.Cluster.dll
Syntax
public class InMemoryAuditTrail : Disposable, IPersistentState, IAuditTrail<IRaftLogEntry>, IAuditTrail
Constructors
|
Improve this Doc
View Source
InMemoryAuditTrail()
Initializes a new audit trail with empty log.
Declaration
public InMemoryAuditTrail()
Properties
|
Improve this Doc
View Source
SyncRoot
Gets the lock that can be used to synchronize access to this object.
Declaration
protected AsyncLock SyncRoot { get; }
Property Value
| Type |
Description |
| AsyncLock |
|
Methods
|
Improve this Doc
View Source
ApplyAsync(IRaftLogEntry)
Applies the command represented by the log entry to the underlying database engine.
Declaration
protected virtual ValueTask ApplyAsync(IRaftLogEntry entry)
Parameters
| Type |
Name |
Description |
| IRaftLogEntry |
entry |
The entry to be applied to the state machine.
|
Returns
| Type |
Description |
| ValueTask |
The task representing asynchronous execution of this method.
|
|
Improve this Doc
View Source
Dispose(Boolean)
Releases all resources associated with this audit trail.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type |
Name |
Description |
| Boolean |
disposing |
Indicates whether the Dispose(Boolean) has been called directly or from finalizer.
|
|
Improve this Doc
View Source
FlushAsync()
Flushes the underlying data storage.
Declaration
protected virtual ValueTask FlushAsync()
Returns
| Type |
Description |
| ValueTask |
The task representing asynchronous execution of this method.
|
|
Improve this Doc
View Source
GetLastIndex(Boolean)
Gets index of the committed or last log entry.
Declaration
public long GetLastIndex(bool committed)
Parameters
| Type |
Name |
Description |
| Boolean |
committed |
true to get the index of highest log entry known to be committed; false to get the index of the last log entry.
|
Returns
| Type |
Description |
| Int64 |
The index of the log entry.
|
Explicit Interface Implementations
|
Improve this Doc
View Source
IPersistentState.IncrementTermAsync()
Declaration
ValueTask<long> IPersistentState.IncrementTermAsync()
Returns
| Type |
Description |
| ValueTask<Int64> |
|
|
Improve this Doc
View Source
IPersistentState.IsVotedFor(IRaftClusterMember)
Declaration
bool IPersistentState.IsVotedFor(IRaftClusterMember member)
Parameters
Returns
|
Improve this Doc
View Source
IPersistentState.Term
Declaration
long IPersistentState.Term { get; }
Returns
|
Improve this Doc
View Source
IPersistentState.UpdateTermAsync(Int64)
Declaration
ValueTask IPersistentState.UpdateTermAsync(long value)
Parameters
| Type |
Name |
Description |
| Int64 |
value |
|
Returns
| Type |
Description |
| ValueTask |
|
|
Improve this Doc
View Source
IPersistentState.UpdateVotedForAsync(IRaftClusterMember)
Declaration
ValueTask IPersistentState.UpdateVotedForAsync(IRaftClusterMember member)
Parameters
Returns
| Type |
Description |
| ValueTask |
|
|
Improve this Doc
View Source
IAuditTrail.CommitAsync(CancellationToken)
Declaration
ValueTask<long> IAuditTrail.CommitAsync(CancellationToken token)
Parameters
| Type |
Name |
Description |
| CancellationToken |
token |
|
Returns
| Type |
Description |
| ValueTask<Int64> |
|
|
Improve this Doc
View Source
IAuditTrail.CommitAsync(Int64, CancellationToken)
Declaration
ValueTask<long> IAuditTrail.CommitAsync(long endIndex, CancellationToken token)
Parameters
| Type |
Name |
Description |
| Int64 |
endIndex |
|
| CancellationToken |
token |
|
Returns
| Type |
Description |
| ValueTask<Int64> |
|
|
Improve this Doc
View Source
IAuditTrail.EnsureConsistencyAsync(CancellationToken)
Declaration
Task IAuditTrail.EnsureConsistencyAsync(CancellationToken token)
Parameters
| Type |
Name |
Description |
| CancellationToken |
token |
|
Returns
|
Improve this Doc
View Source
IAuditTrail.WaitForCommitAsync(Int64, TimeSpan, CancellationToken)
Declaration
Task IAuditTrail.WaitForCommitAsync(long index, TimeSpan timeout, CancellationToken token)
Parameters
| Type |
Name |
Description |
| Int64 |
index |
|
| TimeSpan |
timeout |
|
| CancellationToken |
token |
|
Returns
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(TEntryImpl, Int64)
Declaration
ValueTask IAuditTrail<IRaftLogEntry>.AppendAsync<TEntry>(TEntry entry, long startIndex)
where TEntry : IRaftLogEntry
Parameters
| Type |
Name |
Description |
| TEntry |
entry |
|
| Int64 |
startIndex |
|
Returns
| Type |
Description |
| ValueTask |
|
Type Parameters
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, CancellationToken)
Declaration
ValueTask<long> IAuditTrail<IRaftLogEntry>.AppendAsync<TEntry>(ILogEntryProducer<TEntry> entries, CancellationToken token)
where TEntry : IRaftLogEntry
Parameters
Returns
| Type |
Description |
| ValueTask<Int64> |
|
Type Parameters
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, Int64, Boolean, CancellationToken)
Declaration
ValueTask IAuditTrail<IRaftLogEntry>.AppendAsync<TEntry>(ILogEntryProducer<TEntry> entries, long startIndex, bool skipCommitted, CancellationToken token)
where TEntry : IRaftLogEntry
Parameters
Returns
| Type |
Description |
| ValueTask |
|
Type Parameters
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.DropAsync(Int64, CancellationToken)
Declaration
ValueTask<long> IAuditTrail<IRaftLogEntry>.DropAsync(long startIndex, CancellationToken token)
Parameters
| Type |
Name |
Description |
| Int64 |
startIndex |
|
| CancellationToken |
token |
|
Returns
| Type |
Description |
| ValueTask<Int64> |
|
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.First
Declaration
IRaftLogEntry IAuditTrail<IRaftLogEntry>.First { get; }
Returns
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.ReadAsync<TReader, TResult>(TReader, Int64, CancellationToken)
Declaration
ValueTask<TResult> IAuditTrail<IRaftLogEntry>.ReadAsync<TReader, TResult>(TReader reader, long startIndex, CancellationToken token)
where TReader : ILogEntryConsumer<IRaftLogEntry, TResult>
Parameters
| Type |
Name |
Description |
| TReader |
reader |
|
| Int64 |
startIndex |
|
| CancellationToken |
token |
|
Returns
| Type |
Description |
| ValueTask<TResult> |
|
Type Parameters
| Name |
Description |
| TReader |
|
| TResult |
|
|
Improve this Doc
View Source
IAuditTrail<IRaftLogEntry>.ReadAsync<TReader, TResult>(TReader, Int64, Int64, CancellationToken)
Declaration
ValueTask<TResult> IAuditTrail<IRaftLogEntry>.ReadAsync<TReader, TResult>(TReader reader, long startIndex, long endIndex, CancellationToken token)
where TReader : ILogEntryConsumer<IRaftLogEntry, TResult>
Parameters
| Type |
Name |
Description |
| TReader |
reader |
|
| Int64 |
startIndex |
|
| Int64 |
endIndex |
|
| CancellationToken |
token |
|
Returns
| Type |
Description |
| ValueTask<TResult> |
|
Type Parameters
| Name |
Description |
| TReader |
|
| TResult |
|
Implements
Extension Methods