Show / Hide Table of Contents

Class RaftClusterConfiguration

Allows setting up the special service used for configuration of IRaftCluster instance.

Inheritance
object
RaftClusterConfiguration
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.AspNetCore.Cluster.dll
Syntax
[CLSCompliant(false)]
public static class RaftClusterConfiguration

Methods

| Edit this page View Source

ConfigureCluster<TConfig>(IServiceCollection)

Registers configurator of ICluster service registered as a service in DI container.

Declaration
public static IServiceCollection ConfigureCluster<TConfig>(this IServiceCollection services) where TConfig : class, IClusterMemberLifetime
Parameters
Type Name Description
IServiceCollection services

A collection of services provided by DI container.

Returns
Type Description
IServiceCollection

A modified collection of services.

Type Parameters
Name Description
TConfig

The type implementing IClusterMemberLifetime.

| Edit this page View Source

RestoreStateAsync<TStateMachine>(IApplicationBuilder, CancellationToken)

Restores the state machine.

Declaration
public static ValueTask RestoreStateAsync<TStateMachine>(this IApplicationBuilder app, CancellationToken token = default) where TStateMachine : SimpleStateMachine
Parameters
Type Name Description
IApplicationBuilder app

The application builder.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing the state of the asynchronous operation.

Type Parameters
Name Description
TStateMachine

The type of the state machine.

Remarks

The state machine must be registered previously with UseStateMachine<TStateMachine>(IServiceCollection) method.

| Edit this page View Source

UseConfigurationStorage<TStorage>(IServiceCollection)

Registers a service responsible for maintaining a list of cluster members.

Declaration
public static IServiceCollection UseConfigurationStorage<TStorage>(this IServiceCollection services) where TStorage : class, IClusterConfigurationStorage<UriEndPoint>
Parameters
Type Name Description
IServiceCollection services

A collection of services.

Returns
Type Description
IServiceCollection

A modified collection of services.

Type Parameters
Name Description
TStorage

The type of the storage service.

| Edit this page View Source

UseInMemoryConfigurationStorage(IServiceCollection, Action<ICollection<UriEndPoint>>)

Registers in-memory storage service for maintaining a list of cluster members.

Declaration
public static IServiceCollection UseInMemoryConfigurationStorage(this IServiceCollection services, Action<ICollection<UriEndPoint>> configuration)
Parameters
Type Name Description
IServiceCollection services

A collection of services.

Action<ICollection<UriEndPoint>> configuration

The delegate that allows to configure a list of cluster members at startup.

Returns
Type Description
IServiceCollection

A modified collection of services.

Remarks

In-memory storage is not recommended for production use.

| Edit this page View Source

UsePersistenceEngine<TPersistentState>(IServiceCollection)

Registers custom persistence engine for the Write-Ahead Log based on PersistentState class.

Declaration
public static IServiceCollection UsePersistenceEngine<TPersistentState>(this IServiceCollection services) where TPersistentState : PersistentState
Parameters
Type Name Description
IServiceCollection services

A collection of services provided by DI container.

Returns
Type Description
IServiceCollection

A modified collection of services.

Type Parameters
Name Description
TPersistentState

The type representing custom persistence engine.

Remarks

If background compaction is configured for WAL then you can implement ILogCompactionSupport interface to provide custom logic for log compaction.

| Edit this page View Source

UsePersistenceEngine<TEngine, TImplementation>(IServiceCollection)

Registers custom persistence engine for the Write-Ahead Log based on PersistentState class.

Declaration
public static IServiceCollection UsePersistenceEngine<TEngine, TImplementation>(this IServiceCollection services) where TEngine : class where TImplementation : PersistentState, TEngine
Parameters
Type Name Description
IServiceCollection services

A collection of services provided by DI container.

Returns
Type Description
IServiceCollection

A modified collection of services.

Type Parameters
Name Description
TEngine

An interface used for interaction with the persistence engine.

TImplementation

The type representing custom persistence engine.

Remarks

If background compaction is configured for WAL then you can implement ILogCompactionSupport interface to provide custom logic for log compaction.

| Edit this page View Source

UsePersistentConfigurationStorage(IServiceCollection, string)

Registers persistent storage service for maintaining a list of cluster members.

Declaration
public static IServiceCollection UsePersistentConfigurationStorage(this IServiceCollection services, string path)
Parameters
Type Name Description
IServiceCollection services

A collection of services.

string path

The absolute path to the folder on the local machine to store the list.

Returns
Type Description
IServiceCollection

A modified collection of services.

| Edit this page View Source

UseStateMachine<TStateMachine>(IServiceCollection)

Registers the state machine and the write-ahead log for it.

Declaration
public static IServiceCollection UseStateMachine<TStateMachine>(this IServiceCollection services) where TStateMachine : class, IStateMachine
Parameters
Type Name Description
IServiceCollection services

A collection of services provided by DI container.

Returns
Type Description
IServiceCollection

A modified collection of services.

Type Parameters
Name Description
TStateMachine

The type of the state machine.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾