Class InMemoryClusterConfigurationStorage<TAddress>
Represents in-memory storage of cluster configuration.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft.Membership
Assembly: DotNext.Net.Cluster.dll
Syntax
public abstract class InMemoryClusterConfigurationStorage<TAddress> : ClusterConfigurationStorage<TAddress>, IClusterConfigurationStorage<TAddress>, IClusterConfigurationStorage, IDisposable where TAddress : notnull
Type Parameters
Name | Description |
---|---|
TAddress | The type of cluster member address. |
Constructors
| Edit this page View SourceInMemoryClusterConfigurationStorage(IEqualityComparer<TAddress>?, MemoryAllocator<byte>?)
Initializes a new in-memory configuration storage.
Declaration
protected InMemoryClusterConfigurationStorage(IEqualityComparer<TAddress>? comparer = null, MemoryAllocator<byte>? allocator = null)
Parameters
Type | Name | Description |
---|---|---|
IEqualityComparer<TAddress> | comparer | An object responsible for comparison of |
MemoryAllocator<byte> | allocator | The memory allocator. |
Properties
| Edit this page View SourceActiveConfiguration
Gets active configuration.
Declaration
public override sealed IClusterConfiguration ActiveConfiguration { get; }
Property Value
Type | Description |
---|---|
IClusterConfiguration |
Overrides
| Edit this page View SourceHasProposal
Gets a value indicating that this storage has proposed configuration.
Declaration
public override sealed bool HasProposal { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceProposedConfiguration
Gets proposed configuration.
Declaration
public override sealed IClusterConfiguration? ProposedConfiguration { get; }
Property Value
Type | Description |
---|---|
IClusterConfiguration |
Overrides
Methods
| Edit this page View SourceAddMember(TAddress)
Proposes a new member.
Declaration
public bool AddMember(TAddress address)
Parameters
Type | Name | Description |
---|---|---|
TAddress | address | The address of the cluster member. |
Returns
Type | Description |
---|---|
bool | true if the new member is added to the proposed configuration; false if the storage has the proposed configuration already. |
AddMemberAsync(TAddress, CancellationToken)
Proposes a new member.
Declaration
protected override sealed ValueTask<bool> AddMemberAsync(TAddress address, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
TAddress | address | The address of the cluster member. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<bool> | true if the new member is added to the proposed configuration; false if the storage has the proposed configuration already. |
Overrides
| Edit this page View SourceApplyAsync(CancellationToken)
Applies proposed configuration as active configuration.
Declaration
protected override sealed ValueTask ApplyAsync(CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Overrides
| Edit this page View SourceCreateActiveConfigurationBuilder()
Creates a builder that can be used to initialize active configuration.
Declaration
public InMemoryClusterConfigurationStorage<TAddress>.ConfigurationBuilder CreateActiveConfigurationBuilder()
Returns
Type | Description |
---|---|
InMemoryClusterConfigurationStorage<TAddress>.ConfigurationBuilder | A builder of active configuration. |
Dispose(bool)
Releases managed and unmanaged resources associated with this object.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true if called from Dispose(); false if called from finalizer ~Disposable(). |
Overrides
| Edit this page View SourceLoadConfigurationAsync(CancellationToken)
Loads configuration from the storage.
Declaration
protected override sealed ValueTask LoadConfigurationAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Overrides
| Edit this page View SourceProposeAsync(IClusterConfiguration, CancellationToken)
Proposes the configuration.
Declaration
protected override sealed ValueTask ProposeAsync(IClusterConfiguration configuration, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
IClusterConfiguration | configuration | The proposed configuration. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Overrides
Remarks
If method is called multiple times then ProposedConfiguration will be rewritten.
RemoveMember(TAddress)
Proposes removal of the existing member.
Declaration
public bool RemoveMember(TAddress address)
Parameters
Type | Name | Description |
---|---|---|
TAddress | address | The address of the cluster member. |
Returns
Type | Description |
---|---|
bool | true if the new member is added to the proposed configuration; false if the storage has the proposed configuration already. |
RemoveMemberAsync(TAddress, CancellationToken)
Proposes removal of the existing member.
Declaration
protected override sealed ValueTask<bool> RemoveMemberAsync(TAddress address, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
TAddress | address | The address of the cluster member. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<bool> | true if the new member is added to the proposed configuration; false if the storage has the proposed configuration already. |