Show / Hide Table of Contents

Interface IPersistentState

Represents persistent state of local cluster member required by Raft consensus protocol.

Inherited Members
IAuditTrail<IRaftLogEntry>.ReadAsync<TResult>(ILogEntryConsumer<IRaftLogEntry, TResult>, long, long, CancellationToken)
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, long, bool, CancellationToken)
IAuditTrail<IRaftLogEntry>.AppendAndCommitAsync<TEntryImpl>(ILogEntryProducer<TEntryImpl>, long, bool, long, CancellationToken)
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(TEntryImpl, long, CancellationToken)
IAuditTrail<IRaftLogEntry>.AppendAsync<TEntryImpl>(TEntryImpl, CancellationToken)
IAuditTrail.IsLogEntryLengthAlwaysPresented
IAuditTrail.LastCommittedEntryIndex
IAuditTrail.LastEntryIndex
IAuditTrail.WaitForApplyAsync(long, CancellationToken)
IAuditTrail.WaitForApplyAsync(CancellationToken)
IAuditTrail.CommitAsync(long, CancellationToken)
IAuditTrail.InitializeAsync(CancellationToken)
IAuditTrail.ReadAsync<TResult>(ILogEntryConsumer<ILogEntry, TResult>, long, long, CancellationToken)
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IPersistentState : IAuditTrail<IRaftLogEntry>, IAuditTrail

Properties

| Edit this page View Source

Term

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 Source

IncrementTermAsync(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
Command.AppendAsync<TCommand>(IPersistentState, TCommand, object?, CancellationToken)
PersistentStateExtensions.AppendAsync(IPersistentState, ReadOnlyMemory<byte>, object?, CancellationToken)
PersistentStateExtensions.AppendAsync<T>(IPersistentState, T, object?, CancellationToken)
PersistentStateExtensions.AppendJsonAsync<T>(IPersistentState, T, object?, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾