python-event-sourcery icon indicating copy to clipboard operation
python-event-sourcery copied to clipboard

PoC for multitenancy support

Open Enforcer opened this issue 9 months ago • 0 comments

Play around with API.

The first attempt assumes using ContextVars and context managers:

from event_sourcery.event_store.context import event_sourcery_context

with event_sourcery_context(tenant_id=1):
    # do sth as tenant_1, e.g. create streams etc

There are lots of open questions, e.g.

  • how far the isolation should go,
  • is it possible to achieve certain things stuff in EventStoreDB etc
  • should we allow the same stream IDs inside the tenant context as well as outside of it (and should tenants be able to reuse the same stream_id),
  • the same goes for stream names
  • should we rather have a separate EventStore subclass that allows to work with multitenancy and by default have this disabled (so it looks like there is no multitenancy)

Here's some Example Mapping I tried to make to visualize how I think about it:

obraz

Enforcer avatar May 25 '24 20:05 Enforcer