Interface IProjectionGenerationStore
- Namespace
- Excalibur.EventSourcing.Subscriptions
- Assembly
- Excalibur.EventSourcing.dll
Stores reader routing in the same atomic boundary as subscription member lifetimes.
public interface IProjectionGenerationStore
Remarks
Writers remain pinned to their configured destination. A referenced binding cannot be retired. Physical destination deletion and draining in-flight readers are separate lifecycle operations.
Methods
ReadGenerationAsync(string, string, CancellationToken)
Reads the active pointer and referenced member in one consistent snapshot.
Task<ProjectionGeneration?> ReadGenerationAsync(string subscriptionName, string readerName, CancellationToken cancellationToken)
Parameters
subscriptionNamestringThe stable subscription name.
readerNamestringThe stable reader name.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ProjectionGeneration>
The active generation, or null when no pointer exists.
TryRemoveGenerationAsync(string, string, Guid, CancellationToken)
Decommissions a reader pointer if its revision still matches.
Task<bool> TryRemoveGenerationAsync(string subscriptionName, string readerName, Guid expectedRevision, CancellationToken cancellationToken)
Parameters
subscriptionNamestringThe stable subscription name.
readerNamestringThe reader being decommissioned.
expectedRevisionGuidThe exact observed pointer revision.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<bool>
True when removed; false when absent, superseded, or not applied because of a database concurrency conflict.
Remarks
Stop users of this reader before removal. This does not delete a destination or drain in-flight reads.
TrySetGenerationAsync(string, string, Guid?, string, Guid, long, CancellationToken)
Atomically installs a pointer only if its revision and the target lifetime's progress match.
Task<bool> TrySetGenerationAsync(string subscriptionName, string readerName, Guid? expectedRevision, string projectionKey, Guid bindingId, long minimumPosition, CancellationToken cancellationToken)
Parameters
subscriptionNamestringThe stable subscription name.
readerNamestringThe stable reader name.
expectedRevisionGuid?The observed pointer revision; null requires an absent pointer.
projectionKeystringThe target member key.
bindingIdGuidThe exact target lifetime.
minimumPositionlongThe minimum required contiguous checkpoint; an absent checkpoint never qualifies.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<bool>
True if installed; false if not applied because a precondition did not match or a database concurrency conflict rolled back the mutation.
Remarks
Each successful transition receives a new revision, including rollback. A connection failure can leave the outcome unknown: reread authoritative state before retrying. A successful switch does not drain readers.