View Source DSL: AshStateMachine

Provides tools for defining and working with resource-backed state machines.

state_machine

Nested DSLs

Options

NameTypeDefaultDocs
initial_stateslist(atom)The allowed starting states of this state machine.
deprecated_stateslist(atom)[]A list of states that have been deprecated but are still valid. These will still be in the possible list of states, but :* will not include them.
extra_stateslist(atom)[]A list of states that may be used by transitions to/from :*. See the docs on wildcards for more.
state_attributeatom:stateThe attribute to store the state in.
default_initial_stateatomThe default initial state

state_machine.transitions

Wildcards

Use :* to represent "any action" when used in place of an action, or "any state" when used in place of a state.

For example:

transition :*, from: :*, to: :*

The full list of states is derived at compile time from the transitions. Use the extra_states to express that certain types should be included in that list even though no transitions go to/from that state explicitly. This is necessary for cases where there are states that use :* and no transition explicitly leads to that transition.

Nested DSLs

state_machine.transitions.transition

transition action

Arguments

NameTypeDefaultDocs
actionatomThe corresponding action that is invoked for the transition. Use :* to allow any update action to perform this transition.

Options

NameTypeDefaultDocs
fromlist(atom) | atomThe states in which this action may be called. If not specified, then any state is accepted. Use :* to refer to all states.
tolist(atom) | atomThe states that this action may move to. If not specified, then any state is accepted. Use :* to refer to all states.

Introspection

Target: AshStateMachine.Transition