Interface IRaftClusterMember
Represents cluster member accessible through Raft protocol.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IRaftClusterMember : IClusterMember
Properties
| Improve this Doc View SourceNextIndex
Index of next log entry to send to this node.
Declaration
long NextIndex { get; }
Property Value
Type | Description |
---|---|
Int64 |
Methods
| Improve this Doc View SourceAppendEntriesAsync<TEntry, TList>(Int64, TList, Int64, Int64, Int64, CancellationToken)
Transfers transaction log entry to the member.
Declaration
Task<Result<bool>> AppendEntriesAsync<TEntry, TList>(long term, TList entries, long prevLogIndex, long prevLogTerm, long commitIndex, CancellationToken token)
where TEntry : IRaftLogEntry where TList : IReadOnlyList<TEntry>
Parameters
Type | Name | Description |
---|---|---|
Int64 | term | Term value maintained by local cluster member. |
TList | entries | A set of entries to be replicated with this node. |
Int64 | prevLogIndex | Index of log entry immediately preceding new ones. |
Int64 | prevLogTerm | Term of |
Int64 | commitIndex | Last entry known to be committed by the local node. |
CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Result<Boolean>> | true if message is handled successfully by this member; false if message is rejected due to invalid Term/Index number. |
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 network. |
CancelPendingRequests()
Aborts all active outbound requests.
Declaration
[Obsolete("Use CancelPendingRequestsAsync method instead")]
virtual void CancelPendingRequests()
CancelPendingRequestsAsync()
Aborts all active outbound requests asynchronously.
Declaration
virtual ValueTask CancelPendingRequestsAsync()
Returns
Type | Description |
---|---|
ValueTask | The task representing shutdown operation. |
InstallSnapshotAsync(Int64, IRaftLogEntry, Int64, CancellationToken)
Installs the snapshot of the log to this cluster member.
Declaration
Task<Result<bool>> InstallSnapshotAsync(long term, IRaftLogEntry snapshot, long snapshotIndex, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
Int64 | term | Leader's term. |
IRaftLogEntry | snapshot | The log entry representing the snapshot. |
Int64 | 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<Boolean>> | true if snapshot is installed successfully; otherwise, false. |
Exceptions
Type | Condition |
---|---|
MemberUnavailableException | The member is unreachable through network. |
VoteAsync(Int64, Int64, Int64, CancellationToken)
Requests vote from the member.
Declaration
Task<Result<bool>> VoteAsync(long term, long lastLogIndex, long lastLogTerm, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
Int64 | term | Term value maintained by local cluster member. |
Int64 | lastLogIndex | Index of candidate's last log entry. |
Int64 | 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<Boolean>> | Vote received from member; true if node accepts new leader, false if node doesn't accept new leader, null if node is not available. |