Show / Hide Table of Contents

Struct LogEntry

Represents the log entry maintained by WriteAheadLog instance.

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.StateMachine
Assembly: DotNext.Net.Cluster.dll
Syntax
public readonly struct LogEntry : IInputLogEntry, IRaftLogEntry, ILogEntry, IDataTransferObject

Properties

| Edit this page View Source

CommandId

Represents 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 runtime context associated with the log entry.

Declaration
public object? Context { get; init; }
Property Value
Type Description
object
Remarks

The value passes through AppendAsync<TEntryImpl>(TEntryImpl, CancellationToken) to ApplyAsync(LogEntry) or ApplyAsync(LogEntry). It can be retrieved by using Context property.

| 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 whether this log entry is a snapshot.

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

Length

Gets length of the object payload, in bytes.

Declaration
public long? Length { get; }
Property Value
Type Description
long?
Remarks

If value is null then length of the payload cannot be determined.

| Edit this page View Source

Term

Gets the term of this log entry.

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

Timestamp

Gets UTC time of the log entry when it was created.

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

Methods

| Edit this page View Source

GetPayload()

Gets the payload of this log entry in the form of a memory block sequence.

Declaration
public IEnumerable<ReadOnlyMemory<byte>> GetPayload()
Returns
Type Description
IEnumerable<ReadOnlyMemory<byte>>

A collection of the memory blocks; or empty collection if IsSnapshot is true.

| Edit this page View Source

TryGetPayload(out ReadOnlySequence<byte>)

Attempts to get log entry payload.

Declaration
public bool TryGetPayload(out ReadOnlySequence<byte> sequence)
Parameters
Type Name Description
ReadOnlySequence<byte> sequence

A sequence of bytes representing the log entry payload.

Returns
Type Description
bool

true if this log entry is not a snapshot; otherwise, false.

| Edit this page View Source

WriteToAsync<TWriter>(TWriter, CancellationToken)

Transforms this object to serialized form.

Declaration
public ValueTask WriteToAsync<TWriter>(TWriter writer, CancellationToken token) where TWriter : IAsyncBinaryWriter
Parameters
Type Name Description
TWriter writer

The binary writer.

CancellationToken token

The toke that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing state of asynchronous execution.

Type Parameters
Name Description
TWriter

The type of writer.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

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
☀
☾