Class RaftClusterMember
Represents Raft cluster member that is accessible through the network.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
public abstract class RaftClusterMember : Disposable, IDisposable, IRaftClusterMember, IClusterMember, IPeer
Properties
View SourceEndPoint
Gets the address of this cluster member.
Declaration
public EndPoint EndPoint { get; }
Property Value
| Type | Description |
|---|---|
| EndPoint |
IsLeader
Determines whether this member is a leader.
Declaration
public bool IsLeader { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRemote
Determines whether this member is not a local node.
Declaration
public bool IsRemote { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Status
Gets the status of this member.
Declaration
public ClusterMemberStatus Status { get; }
Property Value
| Type | Description |
|---|---|
| ClusterMemberStatus |
Methods
View SourceCancelPendingRequestsAsync()
Cancels pending requests scheduled for this member.
Declaration
public abstract ValueTask CancelPendingRequestsAsync()
Returns
| Type | Description |
|---|---|
| ValueTask | The task representing asynchronous execution of this method. |
GetMetadataAsync(bool, CancellationToken)
Obtains metadata associated with this member.
Declaration
public ValueTask<IReadOnlyDictionary<string, string>> GetMetadataAsync(bool refresh, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | refresh | true to make a network request to the member and update local cache; false to obtain cached metadata. |
| CancellationToken | token | The token that can be used to cancel operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<IReadOnlyDictionary<string, string>> | The task representing metadata read operation. |
Remarks
This method is completed synchronously is most cases if refresh is false.
Exceptions
| Type | Condition |
|---|---|
| MemberUnavailableException | This member is not reachable through the network. |
ResignAsync(CancellationToken)
Revokes leadership.
Declaration
public abstract Task<bool> ResignAsync(CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<bool> | true, if leadership is revoked successfully; otherwise, false. |
Exceptions
| Type | Condition |
|---|---|
| MemberUnavailableException | This member is not reachable through the network. |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
View SourceTryGetMetadata()
Tries to get cached metadata.
Declaration
public IReadOnlyDictionary<string, string>? TryGetMetadata()
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, string> | The cached metadata; or null if it's not available. |
Events
View SourceMemberStatusChanged
Informs about status change.
Declaration
public event Action<ClusterMemberStatusChangedEventArgs<RaftClusterMember>> MemberStatusChanged
Event Type
| Type | Description |
|---|---|
| Action<ClusterMemberStatusChangedEventArgs<RaftClusterMember>> |