Class EventStoreTimeTravelQuery
- Namespace
- Excalibur.EventSourcing.Queries
- Assembly
- Excalibur.EventSourcing.dll
Default implementation of ITimeTravelQuery that loads all events from the IEventStore and filters by timestamp or version.
public sealed class EventStoreTimeTravelQuery : ITimeTravelQuery
- Inheritance
-
EventStoreTimeTravelQuery
- Implements
- Inherited Members
Remarks
This implementation loads all events for an aggregate and filters client-side. Provider-specific implementations can override this behavior to push filtering to the database for better performance with large event streams.
Constructors
EventStoreTimeTravelQuery(IEventStore)
Initializes a new instance of the EventStoreTimeTravelQuery class.
public EventStoreTimeTravelQuery(IEventStore eventStore)
Parameters
eventStoreIEventStoreThe event store to query events from.
Methods
GetEventsAtPointInTimeAsync(string, string, DateTimeOffset, CancellationToken)
Gets events for an aggregate up to a specific point in time.
public 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.
public 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.
public 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.