Cratis / Chronicle

Event Sourcing database built with ease of use, productivity, compliance and software evolution in mind.
https://cratis.io
MIT License
28 stars 5 forks source link

Clean up and simplify storage provider and its concrete MongoDB implementation #911

Open einari opened 1 year ago

einari commented 1 year ago

The storage provider is 100% reliant on ExecutionContext. This is fragile and counter intuitive while working with the code as the context in which artifacts are is very unclear. Instead we should move forward with a clear and explicit approach with factories, managers or providers that give you an endpoint for getting the specific artifact for the context you need it (MicroserviceId, TenantId...).

In addition to this, the IEventCursor interface should be changed to be an IAsyncEnumerable<>.

Clearer naming and responsibilities needs to be looked at. The goal of this task should be that creating support for another storage engine should be very clear and as simple as possible to do.

einari commented 1 month ago

We have most of this done. We have things like IEventStoreStorage and IEventStoreNamespaceStorage and more. But the implementations of these are done on the concrete level like MongoDB.

It should rather be generic and there should be a storage type definition type that the concrete "driver" or provider that exposes the types to use instead.