retort v2.1.0 Retort.Client.StateMachine

Manipulates the remote state machines over RPC

Summary

Types

Data

State in data struct

t()
  • current_goal - the current state we want data to have.
  • data - the data for pid that has a state field.
  • pid - the RPC client pid, used to update the state of data towards the current_goal
  • predecessor_by_state - the state that can transition to key state
  • previous_goals - a list of the previous current_goals that couldn’t be transitioned to directly because the predecessor in precessor_by_state was not data’s state.
  • update - callback that takes t and updates the state to current_goal

Functions

Transitions data’s state to current_goal. If data’s state is a not direct predecessor of current_goal, then a path is found to get data’s state to current_goal using predecessor_by_state

Types

data()
data() :: %atom{:state => state, optional(atom) => any}

Data

state()
state() :: String.t

State in data struct.

t()
t() :: %Retort.Client.StateMachine{current_goal: String.t, data: data, pid: pid, predecessor_by_state: %{}, previous_goals: [state], timeout: term, update: (t -> {:ok, data} | Retort.Client.Generic.error)}
  • current_goal - the current state we want data to have.
  • data - the data for pid that has a state field.
  • pid - the RPC client pid, used to update the state of data towards the current_goal
  • predecessor_by_state - the state that can transition to key state
  • previous_goals - a list of the previous current_goals that couldn’t be transitioned to directly because the predecessor in precessor_by_state was not data’s state.
  • update - callback that takes t and updates the state to current_goal.

Functions

transition(state_machine)
transition(t) :: {:ok, data} | Retort.Client.Generic.error

Transitions data’s state to current_goal. If data’s state is a not direct predecessor of current_goal, then a path is found to get data’s state to current_goal using predecessor_by_state.

update(state_machine)
update(t) :: {:ok, data} | Retort.Client.Generic.error