Show / Hide Table of Contents

Class PersistentStateExtensions

Provides various extension methods for IPersistentState interface.

Inheritance
object
PersistentStateExtensions
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.Net.Cluster.dll
Syntax
public static class PersistentStateExtensions

Methods

| Edit this page View Source

AppendAsync(IPersistentState, ReadOnlyMemory<byte>, object?, CancellationToken)

Appends a block of bytes to the log tail.

Declaration
public static ValueTask<long> AppendAsync(this IPersistentState state, ReadOnlyMemory<byte> payload, object? context = null, CancellationToken token = default)
Parameters
Type Name Description
IPersistentState state

The log.

ReadOnlyMemory<byte> payload

The log entry payload.

object context

The optional context to be passed to the state machine.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<long>

The index of the added command within the log.

| Edit this page View Source

AppendAsync<T>(IPersistentState, T, object?, CancellationToken)

Appends a binary object to the log tail.

Declaration
public static ValueTask<long> AppendAsync<T>(this IPersistentState state, T payload, object? context = null, CancellationToken token = default) where T : IBinaryFormattable<T>
Parameters
Type Name Description
IPersistentState state

The log.

T payload

The log entry payload.

object context

The optional context to be passed to the state machine.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<long>

The index of the added command within the log.

Type Parameters
Name Description
T

The type of the binary object.

| Edit this page View Source

AppendJsonAsync<T>(IPersistentState, T, object?, CancellationToken)

Appends JSON objec to the log tail.

Declaration
public static ValueTask<long> AppendJsonAsync<T>(this IPersistentState state, T payload, object? context = null, CancellationToken token = default) where T : IJsonSerializable<T>
Parameters
Type Name Description
IPersistentState state

The log.

T payload

The log entry payload.

object context

The optional context to be passed to the state machine.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<long>

The index of the added command within the log.

Type Parameters
Name Description
T

The type of the binary object.

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