Skip to content

Event-storage E0 pre-work for the Weasel.Storage move#4885

Merged
jeremydmiller merged 1 commit into
masterfrom
feat/event-storage-e0-prework
Jul 7, 2026
Merged

Event-storage E0 pre-work for the Weasel.Storage move#4885
jeremydmiller merged 1 commit into
masterfrom
feat/event-storage-e0-prework

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Part of the #4821 / #4830 follow-on: moving the closed-shape event storage (src/Marten/EventStorage/) into Weasel.Storage so Polecat can ship SqlServerEventStoreDialect (the last gate on polecat#273). This is the Marten-only pre-work slice — no Weasel dependency, no behavior change.

What

  1. Hoist QueryForStream off EventStorage<TId> into ClosedShapeEventDocumentStorage. The stream-state lookup rides Marten's query-handler pipeline (IQueryHandler<T> / StreamStateQueryHandler), which stays Marten-local — and the implementation was duplicated verbatim across all three append-mode storages. The movable hierarchy is now purely write-side, and the descriptors drop their now-dead StreamStateSelectSql slot (the adapter uses the base's StreamStateSelectSql).

  2. Batched quick-append becomes dialect-supplied via a CreateQuickAppendEventsOperation factory slot on the Quick / QuickWithServerTimestamps descriptors, installed by PostgresEventStoreDialect. The batch shape is inherently provider-specific (Postgres binds per-column array parameters to mt_quick_append_events; SQL Server will use a multi-row INSERT + OUTPUT shape), so QuickAppendEventsOperation / QuickAppendEventsOperationBase stay Marten-local when the hierarchy moves — exactly like PostgresStorageDialect stayed on the document side.

Validation

  • EventSourcingTests: 1425 passed / 0 failed (net10)
  • TenantPartitionedEventsTests: 215 passed / 0 failed (net10)
  • Full Marten.slnx Debug + Release clean

Next slices (gated on Weasel): E1 neutral grouped-parameter builder in Weasel.Core, E2 descriptor-core move, E3 storage/ops move.

🤖 Generated with Claude Code

Two Marten-only refactors that shrink the movable closed-shape event-storage
surface ahead of the Weasel.Storage extraction (event side of the W2 train):

1. Hoist QueryForStream off EventStorage<TId> into
   ClosedShapeEventDocumentStorage. The stream-state lookup rides Marten's
   query-handler pipeline (IQueryHandler<T> / StreamStateQueryHandler), which
   stays Marten-local, and the implementation was identical across all three
   append-mode storages. The movable hierarchy is now purely write-side, and
   the descriptors drop their StreamStateSelectSql slot (the adapter reads the
   base's StreamStateSelectSql instead).

2. Make the batched quick-append operation dialect-supplied via a
   CreateQuickAppendEventsOperation factory slot on the Quick /
   QuickWithServerTimestamps descriptors, installed by
   PostgresEventStoreDialect. The batch shape is inherently provider-specific
   (Postgres binds array parameters to mt_quick_append_events; SQL Server will
   use a different SQL shape entirely), so QuickAppendEventsOperation and
   QuickAppendEventsOperationBase stay Marten-local when the hierarchy moves.

Validated: EventSourcingTests 1425 + TenantPartitionedEventsTests 215 green
(net10), full solution Debug+Release clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant