Show / Hide Table of Contents

Interface IRaftClusterMember

Represents cluster member accessible through Raft protocol.

Inherited Members
IClusterMember.Id
IClusterMember.IsLeader
IClusterMember.IsRemote
IClusterMember.MemberStatusChanged
IClusterMember.Status
IClusterMember.GetMetadataAsync(bool, CancellationToken)
IClusterMember.ResignAsync(CancellationToken)
IClusterMember.OnMemberStatusChanged<TMember>(TMember, ref ClusterMemberStatus, ClusterMemberStatus, InvocationList<Action<ClusterMemberStatusChangedEventArgs<TMember>>>)
IPeer.EndPoint
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IRaftClusterMember : IClusterMember, IPeer

Fields

| Edit this page View Source

MessageTypeAttributeName

Represents metrics attribute containing Raft message type.

Declaration
protected const string MessageTypeAttributeName = "dotnext.raft.client.message"
Field Value
Type Description
string
| Edit this page View Source

RemoteAddressMeterAttributeName

Represents metrics attribute containing the address of the local node.

Declaration
protected const string RemoteAddressMeterAttributeName = "dotnext.raft.client.address"
Field Value
Type Description
string

Properties

| Edit this page View Source

State

Gets a reference to the replication state.

Declaration
ref IRaftClusterMember.ReplicationState State { get; }
Property Value
Type Description
IRaftClusterMember.ReplicationState
Remarks

Implementing class should provide memory storage for IRaftClusterMember.ReplicationState type without any special semantics.

Methods

| Edit this page View Source

AppendEntriesAsync<TEntry, TList>(long, TList, long, long, long, IClusterConfiguration, bool, CancellationToken)

Transfers log entries to the member.

Declaration
Task<Result<HeartbeatResult>> AppendEntriesAsync<TEntry, TList>(long term, TList entries, long prevLogIndex, long prevLogTerm, long commitIndex, IClusterConfiguration config, bool applyConfig, CancellationToken token) where TEntry : IRaftLogEntry where TList : IReadOnlyList<TEntry>
Parameters
Type Name Description
long term

Term value maintained by local cluster member.

TList entries

A set of entries to be replicated with this node.

long prevLogIndex

Index of log entry immediately preceding new ones.

long prevLogTerm

Term of prevLogIndex entry.

long commitIndex

Last entry known to be committed by the local node.

IClusterConfiguration config

The list of cluster members.

bool applyConfig

true to inform that the receiver must apply previously proposed configuration; false to propose a new configuration.

CancellationToken token

The token that can be used to cancel asynchronous operation.

Returns
Type Description
Task<Result<HeartbeatResult>>

The processing result.

Type Parameters
Name Description
TEntry

The type of the log entry.

TList

The type of the log entries list.

Exceptions
Type Condition
MemberUnavailableException

The member is unreachable through the network.

| Edit this page View Source

CancelPendingRequestsAsync()

Aborts all active outbound requests asynchronously.

Declaration
ValueTask CancelPendingRequestsAsync()
Returns
Type Description
ValueTask

The task representing shutdown operation.

| Edit this page View Source

InstallSnapshotAsync(long, IRaftLogEntry, long, CancellationToken)

Installs the snapshot of the log to this cluster member.

Declaration
Task<Result<HeartbeatResult>> InstallSnapshotAsync(long term, IRaftLogEntry snapshot, long snapshotIndex, CancellationToken token)
Parameters
Type Name Description
long term

Leader's term.

IRaftLogEntry snapshot

The log entry representing the snapshot.

long snapshotIndex

The index of the last included log entry in the snapshot.

CancellationToken token

The token that can be used to cancel asynchronous operation.

Returns
Type Description
Task<Result<HeartbeatResult>>

The processing result.

Exceptions
Type Condition
MemberUnavailableException

The member is unreachable through the network.

| Edit this page View Source

PreVoteAsync(long, long, long, CancellationToken)

Checks whether the transition to Candidate state makes sense.

Declaration
Task<Result<PreVoteResult>> PreVoteAsync(long term, long lastLogIndex, long lastLogTerm, CancellationToken token)
Parameters
Type Name Description
long term

Term value maintained by local cluster member.

long lastLogIndex

Index of candidate's last log entry.

long lastLogTerm

Term of candidate's last log entry.

CancellationToken token

The token that can be used to cancel asynchronous operation.

Returns
Type Description
Task<Result<PreVoteResult>>

Pre-vote result received from the member.

Remarks

Called by a server before changing itself to Candidate status. If a majority of servers return true, proceed to Candidate. Otherwise, wait for another election timeout.

See Also
Four modifications for the Raft consensus algorithm.
| Edit this page View Source

SynchronizeAsync(long, CancellationToken)

Starts a new round of heartbeats.

Declaration
Task<long?> SynchronizeAsync(long commitIndex, CancellationToken token)
Parameters
Type Name Description
long commitIndex

The index of the last committed log entry.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task<long?>

The index of the last committed log entry; or null if the member is not a leader.

Exceptions
Type Condition
MemberUnavailableException

The member is unreachable through the network.

| Edit this page View Source

VoteAsync(long, long, long, CancellationToken)

Requests vote from the member.

Declaration
Task<Result<bool>> VoteAsync(long term, long lastLogIndex, long lastLogTerm, CancellationToken token)
Parameters
Type Name Description
long term

Term value maintained by local cluster member.

long lastLogIndex

Index of candidate's last log entry.

long lastLogTerm

Term of candidate's last log entry.

CancellationToken token

The token that can be used to cancel asynchronous operation.

Returns
Type Description
Task<Result<bool>>

Vote received from the member; true if node accepts new leader, false if node doesn't accept new leader.

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)
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
☀
☾