Interface IPersistentState
Represents persistent state of local cluster member required by Raft consensus protocol.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IPersistentState : IAuditTrail<IRaftLogEntry>, IAuditTrailProperties
| Edit this page View SourceTerm
Reads Term value associated with the local member from the persistent storage.
Declaration
long Term { get; }Property Value
| Type | Description | 
|---|---|
| long | The term restored from persistent storage. | 
Methods
| Edit this page View SourceIncrementTermAsync(ClusterMemberId, CancellationToken)
Increments Term value and persists the item that was voted for on in the last vote.
Declaration
ValueTask<long> IncrementTermAsync(ClusterMemberId member, CancellationToken token = default)Parameters
| Type | Name | Description | 
|---|---|---|
| ClusterMemberId | member | The member which identifier should be stored inside the persistence storage. May be null. | 
| CancellationToken | token | The token that can be used to cancel the operation. | 
Returns
| Type | Description | 
|---|---|
| ValueTask<long> | The updated Term value. | 
Exceptions
| Type | Condition | 
|---|---|
| OperationCanceledException | The operation has been canceled. | 
IsVotedFor(in ClusterMemberId)
Determines whether the local member granted its vote for the specified remote member.
Declaration
bool IsVotedFor(in ClusterMemberId id)Parameters
| Type | Name | Description | 
|---|---|---|
| ClusterMemberId | id | The cluster member to check. | 
Returns
| Type | Description | 
|---|---|
| bool | true if the local member granted its vote for the specified remote member; otherwise, false. | 
UpdateTermAsync(long, bool, CancellationToken)
Persists the last actual Term.
Declaration
ValueTask UpdateTermAsync(long term, bool resetLastVote, CancellationToken token = default)Parameters
| Type | Name | Description | 
|---|---|---|
| long | term | The term value to be persisted. | 
| bool | resetLastVote | true to reset information about the last vote; false to keep information about the last vote unchanged. | 
| CancellationToken | token | The token that can be used to cancel the operation. | 
Returns
| Type | Description | 
|---|---|
| ValueTask | The task representing asynchronous execution of the operation. | 
Exceptions
| Type | Condition | 
|---|---|
| OperationCanceledException | The operation has been canceled. | 
UpdateVotedForAsync(ClusterMemberId, CancellationToken)
Persists the item voted for on in the last vote.
Declaration
ValueTask UpdateVotedForAsync(ClusterMemberId member, CancellationToken token = default)Parameters
| Type | Name | Description | 
|---|---|---|
| ClusterMemberId | member | The member which identifier should be stored inside the persistence storage. | 
| CancellationToken | token | The token that can be used to cancel the operation. | 
Returns
| Type | Description | 
|---|---|
| ValueTask | The task representing state of the asynchronous execution. | 
Exceptions
| Type | Condition | 
|---|---|
| OperationCanceledException | The operation has been canceled. |