toraritte / commanded-eventstore-adapter

EventStore adapter for Commanded
MIT License
0 stars 1 forks source link

Explore adapter implementation methods #1

Open toraritte opened 6 years ago

toraritte commented 6 years ago

CAVEAT (and note mostly to self) The reasoning below may be deeply flawed; think this through a couple times with a fresh mind.


I don't like commanded/commanded being included in the dependencies because

  1. it is a heavy one
  2. this adapter is specifically for Commanded, and it will be included in a project if commanded/eventstore is used, therefore all the commanded modules will be available, thus the Commanded.EventStore behaviour as well.

As for checking behaviour conformity, I started looking into how adapters for Phoenix.PubSub and Phoenix.Ecto.SQL are implemented and it does seem to exist a uniform way.

Phoenix.PubSub is messy, and exactly the kind of solution that I would like to avoid here. Will do a write-up, but basically it requires implementing specific GenServer calls (?), without being backed by a behaviour or protocol. The containing phoenix_pubsub repo also contains the PG2 adapter implementation, and the separate Redis adapter includes phoenix_pubsub in its dependencies and calls modules in it directly.

The Ecto.Adapter behaviour seems well thought out, and sub-behaviours help to separate different functionality. The only problem is that I have still only scratched the surface, and it exponentially gets more complex when going into the adapter implementation themselves.

Bottom line: behaviour conformity will be informal and will come up with a plan.

toraritte commented 6 years ago

See latest notes in mix.exs.