ex_state v0.3.0 ExState.Execution View Source

ExState.Execution executes state transitions with a state chart.

Link to this section Summary

Functions

Completes a step and transitions the execution with {:completed, step_id} event.

Continues a workflow execution from the specified state.

Completes a decision and transitions the execution with {:decision, step_id, decision} event.

Returns serializable data representing the execution.

Executes the provided action name through the callback module.

Executes any queued actions on the execution.

Creates a new workflow execution from the initial state.

Transitions execution with the event and returns a result tuple.

Transitions execution with the event and returns updated or unchanged execution.

Continues a workflow execution with the completed steps. Use in conjunction with continue to resume execution.

Link to this section Types

Link to this type

t()

View Source
t() :: %ExState.Execution{
  actions: [atom()],
  callback_mod: module(),
  chart: ExState.Definition.Chart.t(),
  context: map(),
  history: [ExState.Definition.State.t()],
  meta: map(),
  state: ExState.Definition.State.t(),
  transitions: [ExState.Definition.Transition.t()]
}

Link to this section Functions

Link to this function

complete(execution, step_id)

View Source
complete(t(), atom()) :: {:ok, t()} | {:error, String.t(), t()}

Completes a step and transitions the execution with {:completed, step_id} event.

Link to this function

complete!(execution, step_id)

View Source
Link to this function

continue(workflow, state_name)

View Source
continue(module(), String.t()) :: t()

Continues a workflow execution from the specified state.

Link to this function

continue(workflow, state_name, context)

View Source
continue(module(), String.t(), map()) :: t()
Link to this function

continue(chart, callback_mod, state_name, context)

View Source
continue(ExState.Definition.Chart.t(), module(), String.t(), map()) :: t()
Link to this function

decision(execution, step_id, decision)

View Source
decision(t(), atom(), atom()) :: {:ok, t()} | {:error, String.t(), t()}

Completes a decision and transitions the execution with {:decision, step_id, decision} event.

Link to this function

decision!(execution, step_id, decision)

View Source

Returns serializable data representing the execution.

Link to this function

execute_action(execution, action)

View Source
execute_action(t(), atom()) :: {:ok, t(), any()} | {:error, any()}

Executes the provided action name through the callback module.

Link to this function

execute_actions(execution)

View Source
execute_actions(t()) :: {:ok, t(), map()} | {:error, t(), any()}

Executes any queued actions on the execution.

Link to this function

execute_actions!(execution)

View Source
Link to this function

get_state(execution, name)

View Source

Creates a new workflow execution from the initial state.

Link to this function

new(workflow, context)

View Source
new(module(), map()) :: t()
Link to this function

new(chart, callback_mod, context)

View Source
Link to this function

put_context(execution, context)

View Source
Link to this function

put_context(execution, key, value)

View Source
Link to this function

put_state(execution, state)

View Source
Link to this function

put_subject(execution, subject)

View Source
Link to this function

put_transition(execution, transition)

View Source
Link to this function

transition(execution, event)

View Source
transition(t(), ExState.Definition.Transition.event()) ::
  {:ok, t()} | {:error, String.t(), t()}

Transitions execution with the event and returns a result tuple.

Link to this function

transition!(execution, event)

View Source
Link to this function

transition_maybe(execution, event)

View Source

Transitions execution with the event and returns updated or unchanged execution.

Link to this function

will_transition?(execution, event)

View Source
Link to this function

with_completed(execution, state_name, step_name, decision \\ nil)

View Source
with_completed(t(), String.t(), String.t(), any()) :: t()

Continues a workflow execution with the completed steps. Use in conjunction with continue to resume execution.

Link to this function

with_meta(execution, key, value)

View Source
with_meta(t(), any(), any()) :: t()