Interface IClusterMember
Represents cluster member.
Namespace: DotNext.Net.Cluster
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IClusterMember
Properties
| Improve this Doc View SourceEndpoint
Represents cluster member endpoint that can be used to send messages specific to consensus protocol.
Declaration
IPEndPoint Endpoint { get; }
Property Value
Type | Description |
---|---|
IPEndPoint |
Id
Gets unique identifier of this member.
Declaration
virtual ClusterMemberId Id { get; }
Property Value
Type | Description |
---|---|
ClusterMemberId |
IsLeader
Indicates that executing host is a leader node in the cluster.
Declaration
bool IsLeader { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsRemote
Indicates that this instance represents remote or local cluster member.
Declaration
bool IsRemote { get; }
Property Value
Type | Description |
---|---|
Boolean |
Status
Gets status of this member.
Declaration
ClusterMemberStatus Status { get; }
Property Value
Type | Description |
---|---|
ClusterMemberStatus |
Methods
| Improve this Doc View SourceGetMetadataAsync(Boolean, CancellationToken)
Obtains metadata associated with this member.
Declaration
ValueTask<IReadOnlyDictionary<string, string>> GetMetadataAsync(bool refresh = false, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Boolean | 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. |
OnMemberStatusChanged(IClusterMember, ref AtomicEnum<ClusterMemberStatus>, ClusterMemberStatus, ClusterMemberStatusChanged)
Helper method for raising MemberStatusChanged event.
Declaration
static void OnMemberStatusChanged(IClusterMember member, ref AtomicEnum<ClusterMemberStatus> status, ClusterMemberStatus newState, ClusterMemberStatusChanged memberStatusChanged)
Parameters
Type | Name | Description |
---|---|---|
IClusterMember | member | The current member. |
AtomicEnum<ClusterMemberStatus> | status | The member status holder. |
ClusterMemberStatus | newState | A new state of the member. |
ClusterMemberStatusChanged | memberStatusChanged | A collection of event handlers. |
ResignAsync(CancellationToken)
Revokes leadership.
Declaration
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<Boolean> | true, if leadership is revoked successfully; otherwise, false. |
Exceptions
Type | Condition |
---|---|
MemberUnavailableException | This member is not reachable through the network. |
Events
| Improve this Doc View SourceMemberStatusChanged
An event raised when cluster member becomes available or unavailable.
Declaration
event ClusterMemberStatusChanged MemberStatusChanged
Event Type
Type | Description |
---|---|
ClusterMemberStatusChanged |