Show / Hide Table of Contents

Interface ICluster

Represents local view of the entire cluster.

Inherited Members
IPeerMesh<IClusterMember>.TryGetPeer(EndPoint)
IPeerMesh.Peers
IPeerMesh.PeerDiscovered
IPeerMesh.PeerGone
Namespace: DotNext.Net.Cluster
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface ICluster : IPeerMesh<IClusterMember>, IPeerMesh

Properties

View Source

Leader

Gets the leader node.

Declaration
IClusterMember? Leader { get; }
Property Value
Type Description
IClusterMember

Methods

View Source

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

View Source

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

View Source

LeaderChanged

An event raised when leader has been changed.

Declaration
event Action<ICluster, IClusterMember?> LeaderChanged
Event Type
Type Description
Action<ICluster, IClusterMember>

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾