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.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.CreateException()
Disposable.DisposedTask
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(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.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

| Edit this page View Source

CommandInterpreter()

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

Declaration
protected CommandInterpreter()

Methods

| Edit this page 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) method.

Exceptions
Type Condition
CommandInterpreter.UnknownCommandException

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

OperationCanceledException

The operation has been canceled.

| Edit this page 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) 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.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
☀
☾