Struct PersistentState.LogEntry
Represents persistent log entry.
Namespace: DotNext.Net.Cluster.Consensus.Raft
Assembly: DotNext.Net.Cluster.dll
Syntax
protected struct LogEntry : IRaftLogEntry, ILogEntry, IDataTransferObject
Properties
| Improve this Doc View SourceIsSnapshot
Gets a value indicating that this log entry is 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 SourceCopyTo(Stream, CancellationToken)
Copies the object content into the specified stream synchronously.
Declaration
public void CopyTo(Stream output, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | output | The output stream receiving object content. |
| CancellationToken | token | The token that can be used to cancel asynchronous operation. |
CopyToAsync(PipeWriter, CancellationToken)
Copies the log entry content into the specified pipe writer.
Declaration
public ValueTask CopyToAsync(PipeWriter output, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| PipeWriter | output | The writer. |
| CancellationToken | token | The token that can be used to cancel operation. |
Returns
| Type | Description |
|---|---|
| ValueTask | The task representing asynchronous execution of this method. |
CopyToAsync(Stream, CancellationToken)
Copies the object content into the specified stream.
Declaration
public Task CopyToAsync(Stream output, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | output | The output stream receiving object content. |
| CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |
Read(Int32)
Reads the number of bytes using the pre-allocated buffer.
Declaration
public ReadOnlySpan<byte> Read(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<Byte> | The span of bytes representing buffer segment. |
Remarks
You can use
ReadAsync(Int32, CancellationToken)
Reads asynchronously the number of bytes using the pre-allocated buffer.
Declaration
public Task<ReadOnlyMemory<byte>> ReadAsync(int count, CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | The number of bytes to read. |
| CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<ReadOnlyMemory<Byte>> | The span of bytes representing buffer segment. |
Remarks
You can use
ReadString(Int32, DecodingContext)
Reads the string using the specified encoding.
Declaration
public string ReadString(int length, DecodingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | length | The length of the string, in bytes. |
| DecodingContext | context | The decoding context. |
Returns
| Type | Description |
|---|---|
| String | The string decoded from the log entry content stream. |
Remarks
The characters should be prefixed with the length in the underlying stream.
ReadStringAsync(Int32, DecodingContext, CancellationToken)
Reads the string asynchronously using the specified encoding.
Declaration
public Task<string> ReadStringAsync(int length, DecodingContext context, CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | length | The length of the string, in bytes. |
| DecodingContext | context | The decoding context. |
| CancellationToken | token | The token that can be used to cancel asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<String> | The string decoded from the log entry content stream. |
Remarks
The characters should be prefixed with the length in the underlying stream.
Explicit Interface Implementations
| Improve this Doc View SourceIDataTransferObject.IsReusable
Declaration
bool IDataTransferObject.IsReusable { get; }
Returns
| Type | Description |
|---|---|
| Boolean |
IDataTransferObject.Length
Declaration
long? IDataTransferObject.Length { get; }
Returns
| Type | Description |
|---|---|
| Nullable<Int64> |