Interface IAuditTrail
Represents audit trail responsible for maintaining log entries.
Namespace: DotNext.Net.Cluster.Replication
Assembly: DotNext.Net.Cluster.dll
Syntax
public interface IAuditTrail
Methods
| Improve this Doc View SourceCommitAsync(CancellationToken)
Commits log entries into the underlying storage and marks these entries as committed.
Declaration
ValueTask<long> CommitAsync(CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<Int64> | The actual number of committed entries. |
Remarks
This method should updates cached value provided by method GetLastIndex(Boolean) called with argument of value true. Additionally, it may force log compaction and squash all committed entries into single entry called snapshot.
CommitAsync(Int64, CancellationToken)
Commits log entries into the underlying storage and marks these entries as committed.
Declaration
ValueTask<long> CommitAsync(long endIndex, CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | endIndex | The index of the last entry to commit, inclusively; if null then commits all log entries started from the first uncommitted entry to the last existing log entry. |
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| ValueTask<Int64> | The actual number of committed entries. |
Remarks
This method should updates cached value provided by method GetLastIndex(Boolean) called with argument of value true. Additionally, it may force log compaction and squash all committed entries into single entry called snapshot.
EnsureConsistencyAsync(CancellationToken)
Ensures that all committed entries are applied to the underlying data state machine known as database engine.
Declaration
Task EnsureConsistencyAsync(CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | The token that can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task | The task representing asynchronous state of the method. |
GetLastIndex(Boolean)
Gets index of the committed or last log entry.
Declaration
long GetLastIndex(bool committed)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | committed | true to get the index of highest log entry known to be committed; false to get the index of the last log entry. |
Returns
| Type | Description |
|---|---|
| Int64 | The index of the log entry. |
Remarks
This method is synchronous because returning value should be cached and updated in memory by implementing class.
WaitForCommitAsync(Int64, TimeSpan, CancellationToken)
Waits for the commit.
Declaration
Task WaitForCommitAsync(long index, TimeSpan timeout, CancellationToken token = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | index | The index of the log record to be committed. |
| TimeSpan | timeout | The timeout used to wait for the commit. |
| CancellationToken | token | The token that can be used to cancel waiting. |
Returns
| Type | Description |
|---|---|
| Task | The task representing waiting operation. |