InMemoryEventStore

In-memory implementation of EventStore for testing and development purposes. Stores event streams in memory using thread-safe collections.

Author

ahoo wang

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open override fun append(eventStream: DomainEventStream): Mono<Void>

Appends a domain event stream to the event store. Logs the operation and maps version conflicts to appropriate exceptions.

Link copied to clipboard
open override fun appendStream(eventStream: DomainEventStream): Mono<Void>

Appends an event stream to the in-memory storage. Validates version conflicts and duplicate request IDs.

Link copied to clipboard
open override fun load(aggregateId: AggregateId, headVersion: Int, tailVersion: Int): Flux<DomainEventStream>

Loads domain event streams for the specified aggregate within the given version range. Validates that headVersion is non-negative and tailVersion is greater than or equal to headVersion.

open override fun load(aggregateId: AggregateId, headEventTime: Long, tailEventTime: Long): Flux<DomainEventStream>

Loads domain event streams for the specified aggregate within the given event time range. Validates that tailEventTime is greater than or equal to headEventTime.

Link copied to clipboard
open override fun loadStream(aggregateId: AggregateId, headVersion: Int, tailVersion: Int): Flux<DomainEventStream>

Loads event streams for the specified aggregate within the version range. Returns copies of the stored event streams.

open override fun loadStream(aggregateId: AggregateId, headEventTime: Long, tailEventTime: Long): Flux<DomainEventStream>

Loads event streams for the specified aggregate within the event time range. Returns copies of the stored event streams.

Link copied to clipboard

Wraps an EventStore with metrics collection capabilities. Returns a MetricEventStore that collects metrics on event storage operations.