Struct PersistentState.LogEntry
Represents persistent log entry.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
protected struct LogEntry : IRaftLogEntry, Log.ILogEntry, IAsyncBinaryReader
Properties
| Improve this Doc View SourceIsSnapshot
Gets a value indicating that this entry is a snapshot entry.
Declaration
public bool IsSnapshot { get; }
Property Value
Type | Description |
---|---|
Boolean |
Length
Gets length of the log entry content, in bytes.
Declaration
public long Length { get; }
Property Value
Type | Description |
---|---|
Int64 |
Term
Gets Raft term of this log entry.
Declaration
public long Term { get; }
Property Value
Type | Description |
---|---|
Int64 |
Timestamp
Gets timestamp of this log entry.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Methods
| Improve this Doc View SourceCopyToAsync(PipeWriter, CancellationToken)
Copies the remaining content from this log entry to the specified stream.
Declaration
public Task CopyToAsync(PipeWriter output, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
PipeWriter | output | The stream used as copy destination. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task | The task representing state of asynchronous execution. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
CopyToAsync(Stream, CancellationToken)
Copies the remaining content from this log entry to the specified stream.
Declaration
public Task CopyToAsync(Stream output, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Stream | output | The stream used as copy destination. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task | The task representing state of asynchronous execution. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
ReadAsync(Memory<Byte>, CancellationToken)
Reads the data of exact size.
Declaration
public ValueTask ReadAsync(Memory<byte> output, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Memory<Byte> | output | The buffer to be modified with the data from log entry. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing state of asynchronous execution. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
EndOfStreamException | The end of the stream is reached. |
ReadAsync<T>(CancellationToken)
Reads the value of blittable type from the log entry and advances position in the underlying stream.
Declaration
public ValueTask<T> ReadAsync<T>(CancellationToken token = default(CancellationToken))
where T : struct
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<T> | Decoded value of blittable type. |
Type Parameters
Name | Description |
---|---|
T | The type of value to read. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
EndOfStreamException | The end of the stream is reached. |
ReadStringAsync(StringLengthEncoding, DecodingContext, CancellationToken)
Reads the string of the specified encoding.
Declaration
public ValueTask<string> ReadStringAsync(StringLengthEncoding lengthFormat, DecodingContext context, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
StringLengthEncoding | lengthFormat | Indicates how the string length is encoded in underlying stream. |
DecodingContext | context | The context of string decoding. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<String> | The decoded string. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
EndOfStreamException | The end of the stream is reached. |
ReadStringAsync(Int32, DecodingContext, CancellationToken)
Reads the string of the specified encoding and length.
Declaration
public ValueTask<string> ReadStringAsync(int length, DecodingContext context, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Int32 | length | The length of the string, in bytes. |
DecodingContext | context | The context of string decoding. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<String> | The decoded string. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | The operation has been canceled. |
EndOfStreamException | The end of the stream is reached. |