Cizen v0.12.1 Cizen.Automaton behaviour View Source

A saga framework to create an automaton.

Link to this section Summary

Callbacks

Invoked when the automaton is spawned. Saga.Started event will be dispatched after this callback

Invoked when last spawn/2 or yield/2 callback returns a next state

Link to this section Types

Link to this type finish() View Source
finish() :: {Cizen.Automaton, :finish}

Link to this section Functions

Link to this function handle_event(id, event, state) View Source

Performs an effect.

perform/2 blocks the current block until the effect is resolved, and returns the result of the effect.

Note that perform/2 does not work only on the current process.

Link to this section Callbacks

Invoked when the automaton is spawned. Saga.Started event will be dispatched after this callback.

Returned value will be used as the next state to pass yield/2 callback. Returning Automaton.finish() will cause the automaton to finish.

If not defined, default implementation is used, and it passes the given saga struct to yield/2 callback.

Invoked when last spawn/2 or yield/2 callback returns a next state.

Returned value will be used as the next state to pass yield/2 callback. Returning Automaton.finish() will cause the automaton to finish.

If not defined, default implementation is used, and it returns Automaton.finish().