workflow v0.2.0 Workflow.Persistence

Database side effects from Aggregates and Process Managers servers. Having them in a segregated file helps to test, debug and share the uncommon code between them

Summary

Types

positions -> [first, last]

Functions

Receive a module that implements apply function, and rebuild the state from events

Rebuild if events are found, if not found, return the container state with an empty data structure

Types

events()
events() :: [struct]
reason()
reason() :: atom
state()
state() :: struct

positions -> [first, last]

stream()
stream() :: String.t
uuid()
uuid() :: String.t

Functions

apply_events(module, state, events)

Receive a module that implements apply function, and rebuild the state from events

persist_events(pending_events, uuid, expected_version)
rebuild_from_events(state)

Rebuild if events are found, if not found, return the container state with an empty data structure

rebuild_from_events(state, start_version)