Show / Hide Table of Contents

Class CommandInterpreter

Represents interpreter of the log entries.

Inheritance
object
Disposable
CommandInterpreter
Implements
IDisposable
IBuildable<CommandInterpreter, CommandInterpreter.Builder>
Inherited Members
Disposable.CreateException()
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.TrySetDisposedException(TaskCompletionSource)
Disposable.Dispose(bool)
Disposable.DisposeAsyncCore()
Disposable.DisposeAsync()
Disposable.TryBeginDispose()
Disposable.Dispose()
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(params IEnumerable<IAsyncDisposable>)
Disposable.Dispose<TDisposable>(params ReadOnlySpan<TDisposable>)
Disposable.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.DisposedTask
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Net.Cluster.Consensus.Raft.Commands
Assembly: DotNext.Net.Cluster.dll
Syntax
public class CommandInterpreter : Disposable, IDisposable, IBuildable<CommandInterpreter, CommandInterpreter.Builder>
Remarks

The interpreter can be constructed in two ways: using CommandInterpreter.Builder and through inheritance. If you choose the inheritance then command handlers must be declared as public instance methods marked with CommandInterpreter.CommandHandlerAttribute attribute. Otherwise, command handlers can be registered through the builder.

Constructors

View Source

CommandInterpreter()

Initializes a new interpreter and discovers methods marked with CommandInterpreter.CommandHandlerAttribute attribute.

Declaration
[RequiresUnreferencedCode("Dynamic code generation may be incompatible with IL trimming")]
[RequiresDynamicCode("Runtime binding requires dynamic code compilation")]
protected CommandInterpreter()

Methods

View Source

InterpretAsync<TEntry>(TEntry, object?, CancellationToken)

Interprets log entry asynchronously.

Declaration
public ValueTask<int> InterpretAsync<TEntry>(TEntry entry, object? context, CancellationToken token = default) where TEntry : IRaftLogEntry
Parameters
Type Name Description
TEntry entry

The log entry to be interpreted.

object context

The context to be passed to the handler.

CancellationToken token

The token that can be used to cancel the interpretation.

Returns
Type Description
ValueTask<int>

The ID of the interpreted log entry.

Type Parameters
Name Description
TEntry

The type of the log entry to be interpreted.

Remarks

Typically this method is called by the custom implementation of ApplyAsync(LogEntry, CancellationToken) method.

Exceptions
Type Condition
CommandInterpreter.UnknownCommandException

The command handler was not registered for the command represented by entry.

OperationCanceledException

The operation has been canceled.

View Source

InterpretAsync<TEntry>(TEntry, CancellationToken)

Interprets log entry asynchronously.

Declaration
public ValueTask<int> InterpretAsync<TEntry>(TEntry entry, CancellationToken token = default) where TEntry : IRaftLogEntry
Parameters
Type Name Description
TEntry entry

The log entry to be interpreted.

CancellationToken token

The token that can be used to cancel the interpretation.

Returns
Type Description
ValueTask<int>

The ID of the interpreted log entry.

Type Parameters
Name Description
TEntry

The type of the log entry to be interpreted.

Remarks

Typically this method is called by the custom implementation of ApplyAsync(LogEntry, CancellationToken) method.

Exceptions
Type Condition
CommandInterpreter.UnknownCommandException

The command handler was not registered for the command represented by entry.

OperationCanceledException

The operation has been canceled.

Implements

IDisposable
IBuildable<TSelf, TBuilder>

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾