Show / Hide Table of Contents

Struct PersistentState.LogEntry

Represents persistent log entry.

Implements
IInputLogEntry
IRaftLogEntry
ILogEntry
IDataTransferObject
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
protected readonly struct PersistentState.LogEntry : IInputLogEntry, IRaftLogEntry, ILogEntry, IDataTransferObject
Remarks

Use TransformAsync<TResult, TTransformation>(TTransformation, CancellationToken) to decode the log entry.

Properties

| Edit this page View Source

CommandId

Gets identifier of the command encapsulated by this log entry.

Declaration
public int? CommandId { get; }
Property Value
Type Description
int?
| Edit this page View Source

Context

Gets or sets context associated with this log entry.

Declaration
public object? Context { get; init; }
Property Value
Type Description
object
| Edit this page View Source

Index

Gets the index of this log entry.

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

IsSnapshot

Gets a value indicating that this entry is a snapshot entry.

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

Length

Gets length of the log entry content, in bytes.

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

Term

Gets Raft term of this log entry.

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

Timestamp

Gets timestamp of this log entry.

Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type Description
DateTimeOffset

Methods

| Edit this page View Source

GetReader()

Gets reader that can be used to deserialize the content of this log entry.

Declaration
public IAsyncBinaryReader GetReader()
Returns
Type Description
IAsyncBinaryReader

The binary reader providing access to the content of this log entry.

| Edit this page View Source

TransformAsync<TResult, TTransformation>(TTransformation, CancellationToken)

Converts the data transfer object to another type.

Declaration
public ValueTask<TResult> TransformAsync<TResult, TTransformation>(TTransformation transformation, CancellationToken token) where TTransformation : IDataTransferObject.ITransformation<TResult>
Parameters
Type Name Description
TTransformation transformation

The parser instance.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The converted DTO content.

Type Parameters
Name Description
TResult

The type of result.

TTransformation

The type of parser.

Remarks

The default implementation copies the content into memory before parsing.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Edit this page View Source

TryGetMemory(out ReadOnlyMemory<byte>)

Attempts to obtain the payload of this log entry in the form of the memory block.

Declaration
public bool TryGetMemory(out ReadOnlyMemory<byte> memory)
Parameters
Type Name Description
ReadOnlyMemory<byte> memory

The memory block representing the log entry payload.

Returns
Type Description
bool

true if the log entry payload is available as a memory block; otherwise, false.

Remarks

This method returns false if the log entry is not cached in the memory. Use TransformAsync<TResult, TTransformation>(TTransformation, CancellationToken) as a uniform way to deserialize this payload.

Implements

IInputLogEntry
IRaftLogEntry
ILogEntry
IDataTransferObject

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
Collection.ToAsyncEnumerator<TEnumerator, T>(TEnumerator, CancellationToken)
Collection.ToClassicEnumerator<TEnumerator, T>(TEnumerator)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
DataTransferObject.ToByteArrayAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.ToMemoryAsync<TObject>(TObject, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, MemoryAllocator<byte>?, CancellationToken)
DataTransferObject.TransformAsync<TResult, TObject>(TObject, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, IBufferWriter<byte>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, PipeWriter, long, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, int, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Memory<byte>, CancellationToken)
ExpressionBuilder.Const<T>(T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾