Skip to main content
Table of Contents

Interface ISnapshotService

Namespace
Stratara.Abstractions.EventSourcing
Assembly
Stratara.Abstractions.dll

Decides whether a stream's accumulated event count warrants writing a new snapshot and writes it when needed. Invoked by IEventSource on save.

public interface ISnapshotService
Extension Methods

Remarks

The event source calls it once the batch is committed and published, so the entries it receives are recorded, and a snapshot built from the committed stream captures nothing a failed save wrote. A failure it throws is logged by the event source and does not fail the save: a snapshot is a cache.

Methods

AddSnapshotIfNeededAsync(IEnumerable<EventStreamEntry>, CancellationToken)

Inspect eventStreamEntries grouped by stream; for any stream that has crossed the snapshot threshold, reconstruct + persist a fresh snapshot.

Task AddSnapshotIfNeededAsync(IEnumerable<EventStreamEntry> eventStreamEntries, CancellationToken cancellationToken = default)

Parameters

eventStreamEntries IEnumerable<EventStreamEntry>
cancellationToken CancellationToken

Returns

Task