Porting a Go event sourcing framework to Rust (generics) - RIIR!


I recently felt in love with Rust.

To start using it in broader applications I first need to port my Go event sourcing framework (https://github.com/bloom42/goes) to Rust.

But as being new to Rust I have no idea where to start.

I've found this post (Building an Event Sourcing Crate for Rust | by Kevin Hoffman | Capital One Tech | Medium) and this crate (GitHub - pholactery/eventsourcing: Event Sourcing Library for Rust) which are very close to what I want to implement.

Here is more explicitly what I'm trying to achieve:
Have an Aggregate to which we will execute Commands.
if the Command's validate method is successful then we call the Command's build_event method which returns an Event (trait ? other kind of generic ?).

we then call the apply Event's method to our aggregate to update it's state (or better, update a copy of the aggregate and return a new immutable one).

And finally the Event is 'dispatched' by our Dispatcher which have some SyncReactors and some AsyncReactors registered.

Each Reactor registered for the specific event is called.

Any idea on how to implement this ?

For information, Here is the original article which describe this simplified event sourcing framework (Event Sourcing made Simple. tl;dr: Event Sourcing is to data what… | by Philippe Creux | Kickstarter Engineering)

1 Like