fission / fission-workflows

Workflows for Fission: Fast, reliable and lightweight function composition for serverless functions
Apache License 2.0
371 stars 42 forks source link

Deprecate the clone-mutate update model in the event store #216

Open erwinvaneyk opened 6 years ago

erwinvaneyk commented 6 years ago

For an early implementation of the fes package, we went for a Java-like inheritance approach for the updating of event store models. Each one required 'extending' the fes.BaseEntity and implementing the fes.Entity interface to support copying and state mutation.

Since our Golang expertise has grown, and we have more experience with using event sourcing, this clone-mutate approach has turned out not to be the best idea. It complicates the code a lot, with few (if any) benefits.

To simplify the codebase, we should probably remove the current clone-mutate approach, use cache.GetAggregate for everything, and ensure that ApplyEvent(entity, events) (entity, error) does not mutate state.