Interface ICluster
Represents local view of the entire cluster.
Inherited Members
Namespace: DotNext.Net.Cluster
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface ICluster : IPeerMesh<IClusterMember>, IPeerMesh
Properties
| Edit this page View SourceLeader
Gets the leader node.
Declaration
IClusterMember? Leader { get; }
Property Value
| Type | Description |
|---|---|
| IClusterMember |
Methods
| Edit this page View SourceResignAsync(CancellationToken)
Revokes leadership and starts new election process.
Declaration
ValueTask<bool> ResignAsync(CancellationToken token = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | true if leadership is revoked successfully; otherwise, false. |
WaitForLeaderAsync(TimeSpan, CancellationToken)
Waits for the leader election asynchronously.
Declaration
ValueTask<IClusterMember> WaitForLeaderAsync(TimeSpan timeout, CancellationToken token = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | timeout | The time to wait; or InfiniteTimeSpan. |
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<IClusterMember> | The elected leader. |
Exceptions
| Type | Condition |
|---|---|
| TimeoutException | The operation is timed out. |
| OperationCanceledException | The operation has been canceled. |
| ObjectDisposedException | The local node is disposed. |
Events
| Edit this page View SourceLeaderChanged
An event raised when leader has been changed.
Declaration
event Action<ICluster, IClusterMember?> LeaderChanged
Event Type
| Type | Description |
|---|---|
| Action<ICluster, IClusterMember> |