Show / Hide Table of Contents

Class RaftClusterHttpHost

Represents a host of local Raft cluster node.

Inheritance
object
Disposable
RaftClusterHttpHost
Implements
IDisposable
IHostedService
IAsyncDisposable
Inherited Members
Disposable.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.CreateException()
Disposable.DisposedTask
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.TrySetDisposedException(TaskCompletionSource)
Disposable.TryBeginDispose()
Disposable.Dispose()
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(IEnumerable<IAsyncDisposable>)
Disposable.Dispose<T>(ReadOnlySpan<T>)
Disposable.DisposeAsync(params IAsyncDisposable[])
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.Http
Assembly: DotNext.AspNetCore.Cluster.dll
Syntax
public class RaftClusterHttpHost : Disposable, IDisposable, IHostedService, IAsyncDisposable
Remarks

This class is useful when you want to host multiple Raft clusters inside of the same application. For instance, if you want to implement sharding.

Constructors

| Edit this page View Source

RaftClusterHttpHost(IServiceProvider, string)

Creates a new unstarted Raft cluster locally.

Declaration
public RaftClusterHttpHost(IServiceProvider activationContext, string loggingCategory)
Parameters
Type Name Description
IServiceProvider activationContext

A provider of services required for initialization of IRaftHttpCluster implementation.

string loggingCategory

The category of the logs to be produced by the implementation.

Remarks

A list of required services that must be provided by activationContext:

IOptionsMonitor<TOptions> of type HttpClusterMemberConfigurationProvides configuration of the local cluster member.
ILoggerFactoryProvides logging infrastructure.
A list of optional services that may be provided by activationContext:
IInputChannelProvides custom message processing.
IClusterMemberLifetimeProvides instance lifetime hooks.
IClusterConfigurationStorage<TAddress> of type UriEndPointProvides cluster configuration storage.
IHttpMessageHandlerFactory Provides HttpMessageHandler implementation used by the local node to communicate with other cluster members. This is a key interface that can be used to share the same HTTP connection between multiple cluster instances when accessing the same node.
ClusterMemberAnnouncer<TAddress> of type UriEndPointAllows to announce a new node the cluster leader.
Func<T1, T2, TResult> with generic arguments TimeSpan, IRaftClusterMember, and IFailureDetectorProvides failure detection mechanism that allows the leader to remove unresponsive members from the cluster.
You can supply these services from the implementation of IServiceProvider interface provided by Dependency Injection container or override some of the supplied services using ServiceProviderFactory.

Properties

| Edit this page View Source

Cluster

Gets a local view of Raft cluster.

Declaration
public IRaftHttpCluster Cluster { get; }
Property Value
Type Description
IRaftHttpCluster
| Edit this page View Source

Path

Gets relative URL path of Raft protocol handler.

Declaration
[CLSCompliant(false)]
public PathString Path { get; }
Property Value
Type Description
PathString

Methods

| Edit this page View Source

DispatchAsync(HttpContext)

Dispatches HTTP request to this instance.

Declaration
[CLSCompliant(false)]
public Task DispatchAsync(HttpContext context)
Parameters
Type Name Description
HttpContext context

HTTP request context.

Returns
Type Description
Task

The task representing asynchronous dispatch.

Remarks

This method is useful only when you want to host multiple Raft clusters inside of the same application. For instance, if you want to implement sharding.

| Edit this page View Source

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
Disposable.Dispose(bool)
| Edit this page View Source

DisposeAsync()

Stops hosting of local Raft node and releases all managed resources.

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

The task representing asynchronous operation result.

| Edit this page View Source

DisposeAsyncCore()

Releases managed resources associated with this object asynchronously.

Declaration
protected override ValueTask DisposeAsyncCore()
Returns
Type Description
ValueTask

The task representing asynchronous execution of this method.

Overrides
Disposable.DisposeAsyncCore()
Remarks

This method makes sense only if derived class implements IAsyncDisposable interface.

| Edit this page View Source

StartAsync(CancellationToken)

Starts hosting of local Raft node.

Declaration
public Task StartAsync(CancellationToken token)
Parameters
Type Name Description
CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task

The task representing asynchronous operation result.

| Edit this page View Source

StopAsync(CancellationToken)

Stops hosting of local Raft node.

Declaration
public Task StopAsync(CancellationToken token)
Parameters
Type Name Description
CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Task

The task representing asynchronous operation result.

Implements

IDisposable
IHostedService
IAsyncDisposable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾