Interface IAotProjectionStore<TProjection>
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Provides generated-metadata projection operations without reflection fallback.
public interface IAotProjectionStore<TProjection> where TProjection : class
Type Parameters
TProjectionThe projection state.
Remarks
Resolve this capability through the outer IProjectionStore<TProjection>. Every operation must preserve that store's tenant, encryption and position guarantees. Decorators must mediate these operations or decline the capability; forwarding an inner store is not sufficient. The positioned operations have exactly the concurrency and refusal semantics of IPositionedProjectionStore<TProjection>. The outer store must also expose that positioned capability for shared host startup validation.
Properties
TypeInfo
Gets the registration metadata identifying the generated context. Operations must use that context with the actual source serializer settings to preserve the stored format.
JsonTypeInfo<TProjection> TypeInfo { get; }
Property Value
- JsonTypeInfo<TProjection>
Methods
GetByIdAsync(string, CancellationToken)
Reads the state, confined to the store's ambient tenant.
Task<TProjection?> GetByIdAsync(string id, CancellationToken cancellationToken)
Parameters
idstringProjection identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TProjection>
The state, or null when absent.
GetWithPositionAsync(string, CancellationToken)
Reads the state and position atomically.
Task<(TProjection? Projection, ProjectionPosition Position)> GetWithPositionAsync(string id, CancellationToken cancellationToken)
Parameters
idstringProjection identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<(TProjection Projection, ProjectionPosition Position)>
The state and its position from the same observation.
RefoldAtPositionAsync(string, TProjection, long, CancellationToken)
Conditionally replaces a complete fold while preserving its position.
Task<ProjectionRefoldResult> RefoldAtPositionAsync(string id, TProjection projection, long atPosition, CancellationToken cancellationToken)
Parameters
idstringProjection identifier.
projectionTProjectionReplayed state.
atPositionlongPosition read before replay.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ProjectionRefoldResult>
The authoritative refold outcome.
UpsertAtPositionAsync(string, TProjection, long?, long, CancellationToken)
Conditionally advances from the expected position; never replaces a refused write.
Task<ProjectionAdvanceResult> UpsertAtPositionAsync(string id, TProjection projection, long? expectedPosition, long newPosition, CancellationToken cancellationToken)
Parameters
idstringProjection identifier.
projectionTProjectionFolded state.
expectedPositionlong?Position read before folding, or null for creation.
newPositionlongPosition covered by the fold.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ProjectionAdvanceResult>
The authoritative conditional-write outcome.
UpsertUnnumberedAsync(string, TProjection, CancellationToken)
Stores a complete fold whose coordinate is unknown, explicitly marking it unnumbered.
Task UpsertUnnumberedAsync(string id, TProjection projection, CancellationToken cancellationToken)
Parameters
idstringProjection identifier.
projectionTProjectionComplete folded state.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
A task representing the write.