Table of Contents

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

eventStore IEventStore

The 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

aggregateId string

The aggregate identifier.

aggregateType string

The aggregate type name.

pointInTime DateTimeOffset

The timestamp to query up to (inclusive).

cancellationToken CancellationToken

Cancellation 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

aggregateId string

The aggregate identifier.

aggregateType string

The aggregate type name.

version long

The version to query up to (inclusive).

cancellationToken CancellationToken

Cancellation 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

aggregateId string

The aggregate identifier.

aggregateType string

The aggregate type name.

from DateTimeOffset

The start of the time range (inclusive).

to DateTimeOffset

The end of the time range (inclusive).

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<IReadOnlyList<StoredEvent>>

The events within the specified time range.