Interface IClusterMember
Represents cluster member.
Inherited Members
Namespace: DotNext.Net.Cluster
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IClusterMember : IPeer
Properties
| Edit this page View SourceId
Gets unique identifier of this member.
Declaration
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 |
---|---|
bool |
IsRemote
Indicates that this instance represents remote or local cluster member.
Declaration
bool IsRemote { get; }
Property Value
Type | Description |
---|---|
bool |
Status
Gets status of this member.
Declaration
ClusterMemberStatus Status { get; }
Property Value
Type | Description |
---|---|
ClusterMemberStatus |
Methods
| Edit this page View SourceGetMetadataAsync(bool, CancellationToken)
Obtains metadata associated with this member.
Declaration
ValueTask<IReadOnlyDictionary<string, string>> GetMetadataAsync(bool refresh = false, CancellationToken token = default)
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. |
OnMemberStatusChanged<TMember>(TMember, ref ClusterMemberStatus, ClusterMemberStatus, InvocationList<Action<ClusterMemberStatusChangedEventArgs<TMember>>>)
Helper method for raising MemberStatusChanged event.
Declaration
protected static void OnMemberStatusChanged<TMember>(TMember member, ref ClusterMemberStatus status, ClusterMemberStatus newState, InvocationList<Action<ClusterMemberStatusChangedEventArgs<TMember>>> memberStatusChanged) where TMember : class, IClusterMember
Parameters
Type | Name | Description |
---|---|---|
TMember | member | The current member. |
ClusterMemberStatus | status | The member status holder. |
ClusterMemberStatus | newState | A new state of the member. |
InvocationList<Action<ClusterMemberStatusChangedEventArgs<TMember>>> | memberStatusChanged | A collection of event handlers. |
Type Parameters
Name | Description |
---|---|
TMember | The type of the cluster member. |
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<bool> | true, if leadership is revoked successfully; otherwise, false. |
Exceptions
Type | Condition |
---|---|
MemberUnavailableException | This member is not reachable through the network. |
Events
| Edit this page View SourceMemberStatusChanged
An event raised when cluster member becomes available or unavailable.
Declaration
event Action<ClusterMemberStatusChangedEventArgs> MemberStatusChanged
Event Type
Type | Description |
---|---|
Action<ClusterMemberStatusChangedEventArgs> |