Class ClusterConfigurationStorage<TAddress>
Represents base class for all implementations of cluster configuration storages.
Inheritance
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft.Membership
Assembly: DotNext.Net.Cluster.dll
Syntax
public abstract class ClusterConfigurationStorage<TAddress> : Disposable, IClusterConfigurationStorage<TAddress>, IClusterConfigurationStorage, IDisposable where TAddress : notnull
Type Parameters
| Name | Description |
|---|---|
| TAddress | The type of the cluster member address. |
Properties
View SourceComparer
Gets the comparer of the address.
Declaration
protected virtual IEqualityComparer<TAddress> Comparer { get; }
Property Value
| Type | Description |
|---|---|
| IEqualityComparer<TAddress> |
MemoryAllocator
Gets or sets memory allocator.
Declaration
public MemoryAllocator<byte> MemoryAllocator { get; init; }
Property Value
| Type | Description |
|---|---|
| MemoryAllocator<byte> |
Methods
View SourceDecode(ref SequenceReader)
Decodes the address of the node from its binary representation.
Declaration
protected abstract TAddress Decode(ref SequenceReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| SequenceReader | reader | The reader of binary data. |
Returns
| Type | Description |
|---|---|
| TAddress | The decoded address. |
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
View SourceEncode(TAddress, ref BufferWriterSlim<byte>)
Encodes the address to its binary representation.
Declaration
protected abstract void Encode(TAddress address, ref BufferWriterSlim<byte> writer)
Parameters
| Type | Name | Description |
|---|---|---|
| TAddress | address | The address to encode. |
| BufferWriterSlim<byte> | writer | The buffer for the address. |
LoadConfigurationAsync(CancellationToken)
Loads the configuration from the storage.
Declaration
protected abstract ValueTask<(MemoryOwner<byte> Configuration, long Version)> LoadConfigurationAsync(CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<(MemoryOwner<byte> Configuration, long Version)> | The memory block representing the cluster configuration. |
SaveConfigurationAsync(ReadOnlyMemory<byte>, long, CancellationToken)
Stores the configuration.
Declaration
protected abstract ValueTask<bool> SaveConfigurationAsync(ReadOnlyMemory<byte> configuration, long configurationVersion, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | configuration | The memory block representing the cluster configuration. |
| long | configurationVersion | The version of the configuration. |
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<bool> | The task representing asynchronous result. |
Events
View SourceConfigurationChanged
An event occurred when the configuration is changed.
Declaration
public event Func<IClusterConfiguration<TAddress>, CancellationToken, ValueTask> ConfigurationChanged
Event Type
| Type | Description |
|---|---|
| Func<IClusterConfiguration<TAddress>, CancellationToken, ValueTask> |