Interface ITimeTravelQuery
- Namespace
- Excalibur.EventSourcing.Queries
- Assembly
- Excalibur.EventSourcing.dll
Provides time-travel query capabilities for event-sourced aggregates.
public interface ITimeTravelQuery
Remarks
Time-travel queries enable examining the state of aggregates at any point in their history, either by timestamp or by version number. This is useful for auditing, debugging, historical reporting, and temporal queries.
Implementations should leverage the IEventStore to load events up to the specified point and replay them against the aggregate.
Methods
GetEventsAtPointInTimeAsync(string, string, DateTimeOffset, CancellationToken)
Gets events for an aggregate up to a specific point in time.
ValueTask<IReadOnlyList<StoredEvent>> GetEventsAtPointInTimeAsync(string aggregateId, string aggregateType, DateTimeOffset pointInTime, CancellationToken cancellationToken)
Parameters
aggregateIdstringThe aggregate identifier.
aggregateTypestringThe aggregate type name.
pointInTimeDateTimeOffsetThe timestamp to query up to (inclusive).
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<IReadOnlyList<StoredEvent>>
The events that occurred up to the specified point in time.
GetEventsAtVersionAsync(string, string, long, CancellationToken)
Gets events for an aggregate up to a specific version.
ValueTask<IReadOnlyList<StoredEvent>> GetEventsAtVersionAsync(string aggregateId, string aggregateType, long version, CancellationToken cancellationToken)
Parameters
aggregateIdstringThe aggregate identifier.
aggregateTypestringThe aggregate type name.
versionlongThe version to query up to (inclusive).
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<IReadOnlyList<StoredEvent>>
The events up to and including the specified version.
GetEventsInTimeRangeAsync(string, string, DateTimeOffset, DateTimeOffset, CancellationToken)
Gets events for an aggregate within a specific time range.
ValueTask<IReadOnlyList<StoredEvent>> GetEventsInTimeRangeAsync(string aggregateId, string aggregateType, DateTimeOffset from, DateTimeOffset to, CancellationToken cancellationToken)
Parameters
aggregateIdstringThe aggregate identifier.
aggregateTypestringThe aggregate type name.
fromDateTimeOffsetThe start of the time range (inclusive).
toDateTimeOffsetThe end of the time range (inclusive).
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<IReadOnlyList<StoredEvent>>
The events within the specified time range.