Skip to content

Interface ISnapshotStore

Namespace: Cephalon.Abstractions.EventSourcing
Assembly: Cephalon.Abstractions.dll

Persists and rehydrates optional aggregate snapshots for event-sourced workloads.

public interface ISnapshotStore

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)

streamId string

The stable stream identifier.

cancellationToken CancellationToken

The token that cancels the operation.

Task<(TState? State, long Version)>

A task that returns the snapshot state and version, or the default state and -1 when none exists.

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)

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.

Task

A task that completes when the snapshot has been persisted.

TState

The aggregate state type.