Repository navigation
GH-985: InMemoryDocumentStore implements IEventStore - #988
Merged
Merged
Conversation
The in-memory prototyping store now implements IEventStore<IInMemoryDocumentSession, IInMemoryQuerySession> and is registered as IEventStore by AddInMemoryStoreForPrototyping, so the store-agnostic helpers written against IEventStore (Bobcat's GivenEvents/ThenEvents, services.EventStore()) work on a stub-first app. - AllDatabases() returns a single InMemoryEventDatabase; OpenSession opens a lightweight session on the store - OpenReadOnlyEventStore() is a query session's Events, which now also implements IReadOnlyEventStore: QueryEventsAsync (every filter but tags, which are refused) and QueryStreamStates - Projections are inline, so the database is never stale and reports no async shards; daemon, subscription and compaction members refuse with NotSupportedException - The compliance fixture's EventStore now returns the store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #985. Part of #955.
The in-memory prototyping store now implements
IEventStore<IInMemoryDocumentSession, IInMemoryQuerySession>, andAddInMemoryStoreForPrototypingregisters it asIEventStore. Store-agnostic helpers written againstIEventStore(Bobcat's CritterStack layer,services.EventStore()) now work on a stub-first app instead of throwing "No JasperFx.Events.IEventStore is registered".What the issue asked for, mapped to the change:
AllDatabases()returns oneInMemoryEventDatabase, andOpenSession(database[, tenantId])opens a lightweight session.OpenReadOnlyEventStore()returns a query session'sEvents, which now also implementsIReadOnlyEventStore:FetchStreamAsyncwas already there.QueryEventsAsync(EventQuery)supports every filter except tags (DCB). Tag filters throw rather than being ignored. Paging uses long arithmetic, soPageSize = int.MaxValueis safe.QueryStreamStates()is LINQ-to-objects and works with the shared async terminators.IQueryEventStore,AggregateStreamAsync<T>works directly, the same as on Marten.Events: alreadyIEventOperations+IQueryEventStore.WaitForNonStaleProjectionDataAsyncreturns immediately andAllShards()/AllProjectionProgress()are empty.NotSupportedExceptionwith the store's usual "switch to Marten, Polecat or Fisher" message.The compliance fixture's
EventStorenow returns the store. I didn't enrollEventQueryComplianceorStreamStateQueryCompliance: they register tag types and archive or compact streams, which this store doesn't support. Instead,InMemoryIEventStoreTestshas 9 facts that only use theIEventStorecontract, along the same path Bobcat takes.Tests
EventStoreTests: 286 passed, 22 skipped, on net9.0 and net10.0InMemoryEventStoreTests: 117 passed, 7 skipped (all async-daemon facts, same as before)Follow-up: add an in-memory lane to
WolverineFx.Bobcat's tests once this ships.🤖 Generated with Claude Code
https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4