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 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 existsRequestId(aggregateId: AggregateId, requestId: String): Mono<Boolean>

Checks whether the request ID already exists for the specified aggregate.

Link copied to clipboard
open override fun last(aggregateId: AggregateId): Mono<DomainEventStream>

Loads the last domain event stream for the specified aggregate.

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
open override fun scanAggregateId(namedAggregate: NamedAggregate, afterId: String = FIRST_ID, limit: Int = 10): Flux<AggregateId>

Scans for aggregate IDs within the specified named aggregate, starting after the given ID. Returns a limited number of aggregate IDs in lexicographical order.