Add store-agnostic AllDatabases() to IEventStore (#387)#388
Merged
Conversation
Store-agnostic monitoring/tooling (e.g. CritterWatch) needs an IEventDatabase to call the read abstractions — AllProjectionProgress, plus the FetchDeadLetterCountsAsync / CountDeadLetterEventsAsync reads from #356 — but IEventStore exposed only DatabaseCardinality and offered no store-neutral path to an IEventDatabase. A Marten + Wolverine host registers IEventStore in DI but not IEventDatabase, so GetServices<IEventDatabase>() comes back empty, and the only way to reach the databases was through concrete store types (IMartenStorage.AllDatabases) that a store-agnostic consumer must not reference. Adds: ValueTask<IReadOnlyList<IEventDatabase>> AllDatabases(); as a default interface member returning an empty array as a stand-in, so existing IEventStore implementers keep compiling and degrade gracefully until they override. Marten (delegating to IMartenStorage.AllDatabases()) and Polecat will provide real implementations. Signature mirrors Marten's existing IMartenStorage.AllDatabases(). Companion to #356; unblocks CritterWatch#213 (ProjectionDeadLetters alert). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 27, 2026
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 #387.
What
Adds a store-neutral database accessor to
JasperFx.Events.IEventStore:Shipped as a default interface member that returns an empty array as a stand-in, so every existing
IEventStoreimplementer keeps compiling and degrades gracefully until it overrides. Signature mirrors Marten's existingIMartenStorage.AllDatabases().Why
Store-agnostic monitoring/tooling (e.g. CritterWatch) needs an
IEventDatabaseto call the read abstractions —AllProjectionProgress(...)plusFetchDeadLetterCountsAsync(...)/CountDeadLetterEventsAsync(...)from #356 — but there was no store-neutral way to obtain one:IEventStorein DI (concreteMarten.DocumentStore) but does not registerIEventDatabase, soGetServices<IEventDatabase>()is empty.IEventStorecould only yield its databases through Marten's ownIMartenStorage.AllDatabases()— concrete-store types a store-agnostic consumer must not reference.IEventStoreitself exposed onlyDatabaseCardinality— no path toIEventDatabase.AllDatabases()closes the loop: consumers resolve the already-registeredIEventStoreand enumerateIEventDatabasestore-agnostically.Follow-ups (real implementations)
The default returns empty; the concrete stores will override:
IMartenStorage.AllDatabases())ITenancy.AllDatabases())Tests
AllDatabasesDefaultTestsexercises the default member against a bareIEventStoreand asserts an empty result, mirroringDeadLetterCountDefaultsTestsfrom #356.Companion to #356; unblocks CritterWatch#213 (ProjectionDeadLetters alert).
🤖 Generated with Claude Code