Interface IPersistentState
Represents persistent state of local cluster member required by Raft consensus protocol.
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IPersistentState : Log.IAuditTrail<IRaftLogEntry>
Properties
| Improve this Doc View SourceTerm
Reads Term value associated with the local member from the persistent storage.
Declaration
long Term { get; }
Property Value
Type | Description |
---|---|
Int64 | The term restored from persistent storage. |
Methods
| Improve this Doc View SourceEnsureConsistencyAsync(TimeSpan, CancellationToken)
Suspens the caller until the log entry with term equal to Term will be committed.
Declaration
Task EnsureConsistencyAsync(TimeSpan timeout, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The time to wait. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task | The task representing state of the asynchronous execution. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
TimeoutException | Timeout occurred. |
IncrementTermAsync()
Increments Term value.
Declaration
ValueTask<long> IncrementTermAsync()
Returns
Type | Description |
---|---|
ValueTask<Int64> | The updated Term value. |
IsVotedFor(IRaftClusterMember)
Determines whether the local member granted its vote for the specified remote member.
Declaration
bool IsVotedFor(IRaftClusterMember member)
Parameters
Type | Name | Description |
---|---|---|
IRaftClusterMember | member | The cluster member to check. |
Returns
Type | Description |
---|---|
Boolean | true if the local member granted its vote for the specified remote member; otherwise, false. |
UpdateTermAsync(Int64)
Persists the last actual Term.
Declaration
ValueTask UpdateTermAsync(long term)
Parameters
Type | Name | Description |
---|---|---|
Int64 | term | The term value to be persisted. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous execution of the operation. |
UpdateVotedForAsync(IRaftClusterMember)
Persists the item that was voted for on in the last vote.
Declaration
ValueTask UpdateVotedForAsync(IRaftClusterMember member)
Parameters
Type | Name | Description |
---|---|---|
IRaftClusterMember | member | The member which identifier should be stored inside of persistence storage. May be null. |
Returns
Type | Description |
---|---|
ValueTask | The task representing state of the asynchronous execution. |