GenDurable.Context (gen_durable v0.1.3)

Copy Markdown View Source

The context handed to GenDurable.FSM.step/2 and GenDurable.FSM.handle/2.

state is the FSM's loaded state (a struct when the FSM declares state:, otherwise a plain string-keyed map).

Two signal views: awaited is the subset the step's :await named (what the engine delivers and consumes โ€” empty when the step was not reached via an await), and all is the full instance inbox. Both are empty for handle/2. childs holds this instance's children (spec ยง11) โ€” populated when a parent wakes from schedule_childs, empty otherwise. See GenDurable.FSM.

Summary

Types

signal()

@type signal() :: %{id: integer(), name: String.t(), payload: map()}

t()

@type t() :: %GenDurable.Context{
  all: [signal()],
  attempt: non_neg_integer(),
  awaited: [signal()],
  childs: [
    %{
      id: integer(),
      fsm: String.t(),
      status: String.t(),
      state: map(),
      result: map() | nil,
      last_error: String.t() | nil
    }
  ],
  fsm: String.t(),
  fsm_version: integer(),
  id: integer(),
  state: term(),
  step: String.t()
}