MOQX.Protocol.Transition (moqx v0.8.1)

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.

Summary

Functions

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

Builds a successful transition.

Types

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.