MOQX.Protocol.Transition (moqx v0.10.0)

Copy Markdown View Source

One pure protocol transition returned to the connection runtime.

Events are application-facing protocol events. Actions are requests for the runtime to operate on MOQX.Transport; they are data and are never applied by the protocol implementation itself.

attempt_actions/0 isolates one explicitly selected batch. Its actions still stop at the first failure, but the runtime feeds their result to the protocol before continuing the outer transition. Recovery is a protocol decision; this does not change the failure contract of ordinary actions.

Summary

Functions

Builds a failed transition while retaining the updated protocol state and effects.

Builds a successful transition.

Types

attempt_actions()

@type attempt_actions() :: {:attempt_actions, key :: term(), actions :: [term()]}

result()

@type result() :: {:ok, t()} | {:error, term(), t()}

t()

@type t() :: %MOQX.Protocol.Transition{
  actions: [term()],
  events: [term()],
  state: term()
}

Functions

error(state, reason, opts \\ [])

@spec error(term(), term(), keyword()) :: result()

Builds a failed transition while retaining the updated protocol state and effects.

ok(state, opts \\ [])

@spec ok(term(), keyword()) :: result()

Builds a successful transition.