Interface ISnapshotStore
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
Namespace: Cephalon.Abstractions.EventSourcing
Assembly: Cephalon.Abstractions.dll
Persists and rehydrates optional aggregate snapshots for event-sourced workloads.
public interface ISnapshotStoreMethods
Section titled “Methods”LoadSnapshotAsync<TState>(string, CancellationToken)
Section titled “ LoadSnapshotAsync<TState>(string, CancellationToken)”Loads the latest snapshot for the requested stream.
Task<(TState? State, long Version)> LoadSnapshotAsync<TState>(string streamId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”Task<(TState? State, long Version)>
A task that returns the snapshot state and version, or the default state and -1 when none exists.
Type Parameters
Section titled “Type Parameters”TState
The aggregate state type.
SaveSnapshotAsync<TState>(string, long, TState, CancellationToken)
Section titled “ SaveSnapshotAsync<TState>(string, long, TState, CancellationToken)”Saves one snapshot for the requested stream.
Task SaveSnapshotAsync<TState>(string streamId, long version, TState state, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”streamId string
The stable stream identifier.
version long
The stream version represented by the snapshot.
state TState
The state payload to persist.
cancellationToken CancellationToken
The token that cancels the operation.
Returns
Section titled “Returns”A task that completes when the snapshot has been persisted.
Type Parameters
Section titled “Type Parameters”TState
The aggregate state type.