Class ConsensusOnlyState
Represents lightweight Raft node state that is suitable for distributed consensus only.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public sealed class ConsensusOnlyState : Disposable, IDisposable, IPersistentState, IAuditTrail<IRaftLogEntry>, IAuditTrail
Remarks
The actual state doesn't persist on disk and exists only in memory. Moreover, this implementation cannot append non-empty log entries.
Properties
| Edit this page View SourceLastCommittedEntryIndex
Gets the index of the last committed log entry.
Declaration
public long LastCommittedEntryIndex { get; }
Property Value
Type | Description |
---|---|
long |
LastEntryIndex
Gets the index of the last uncommitted log entry.
Declaration
public long LastEntryIndex { get; }
Property Value
Type | Description |
---|---|
long |
Term
Reads Term value associated with the local member from the persistent storage.
Declaration
public long Term { get; }
Property Value
Type | Description |
---|---|
long | The term restored from persistent storage. |
Methods
| Edit this page View SourceDispose(bool)
Releases all resources associated with this audit trail.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Indicates whether the Dispose(bool) has been called directly or from finalizer. |
Overrides
| Edit this page View SourceReadAsync<TResult>(ILogEntryConsumer<IRaftLogEntry, TResult>, long, long, CancellationToken)
Reads the range of the log entries from this storage.
Declaration
public ValueTask<TResult> ReadAsync<TResult>(ILogEntryConsumer<IRaftLogEntry, TResult> reader, long startIndex, long endIndex, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
ILogEntryConsumer<IRaftLogEntry, TResult> | reader | The reader over log entries. |
long | startIndex | The index of the first log entry to retrieve. |
long | endIndex | The index of the last log entry to retrieve, inclusive. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<TResult> | The result of the transformation applied to the range of the log entries. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |
ReadAsync<TResult>(ILogEntryConsumer<IRaftLogEntry, TResult>, long, CancellationToken)
Reads the log entries starting at the specified index to the end of the log.
Declaration
public ValueTask<TResult> ReadAsync<TResult>(ILogEntryConsumer<IRaftLogEntry, TResult> reader, long startIndex, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
ILogEntryConsumer<IRaftLogEntry, TResult> | reader | The reader over log entries. |
long | startIndex | The index of the first log entry to retrieve. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<TResult> | The result of the transformation applied to the range of the log entries. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |