Table of Contents

Interface ICursorMapStore

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

Persists cursor maps for multi-stream projections, tracking the last-processed event position per source stream.

public interface ICursorMapStore

Remarks

A cursor map is a Dictionary<string, long> mapping streamId → lastProcessedPosition for a named projection. This enables correct resumption after restart without reprocessing or skipping events across streams.

Single-stream projections use ISubscriptionCheckpointStore instead. Cursor maps are only used when a projection has multiple sources via FromStream() or FromCategory().

Methods

GetCursorMapAsync(string, CancellationToken)

Gets the cursor map for a named projection.

Task<IReadOnlyDictionary<string, long>> GetCursorMapAsync(string projectionName, CancellationToken cancellationToken)

Parameters

projectionName string

The unique projection identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyDictionary<string, long>>

A dictionary mapping stream identifiers to their last-processed positions. Returns an empty dictionary if no cursor map exists.

ResetCursorMapAsync(string, CancellationToken)

Resets the cursor map for a named projection, removing all stored positions. Used during projection rebuild to restart from the beginning.

Task ResetCursorMapAsync(string projectionName, CancellationToken cancellationToken)

Parameters

projectionName string

The unique projection identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

SaveCursorMapAsync(string, IReadOnlyDictionary<string, long>, CancellationToken)

Saves the cursor map for a named projection atomically. All stream positions are updated together or not at all.

Task SaveCursorMapAsync(string projectionName, IReadOnlyDictionary<string, long> cursorMap, CancellationToken cancellationToken)

Parameters

projectionName string

The unique projection identifier.

cursorMap IReadOnlyDictionary<string, long>

The stream positions to persist.

cancellationToken CancellationToken

Cancellation token.

Returns

Task