JasperFx / marten

.NET Transactional Document DB and Event Store on PostgreSQL
https://martendb.io
MIT License
2.74k stars 428 forks source link

FetchForWriting optimizations #3289

Closed jeremydmiller closed 1 week ago

jeremydmiller commented 1 week ago

Three things here:

  1. If the aggregate in question is an Inline projection, override the session in question to use the identity map for just that document type, even if it's a lightweight session. The goal here is to avoid double fetching the aggregate current state like we do today
  2. Add a new "lightweight" mechanism for opting into optimistic concurrency for a stream without fetching the actual aggregate. Might be possible today as is. This is an enabler for a more efficient "aggregate handler workflow" in Wolverine
  3. This is almost purely a Wolverine thing, but make sure it's easy to apply live aggregation changes to an existing aggregate when explicitly given events to apply on top. That's in the case of wanting to have the aggregate changes applied before returning from a Wolverine HTTP endpoint or handler.