Xirsys.Sockets.Pipeline (xturn_sockets v2.0.0)

View Source

Declarative multi-tier pipeline specification.

use Xirsys.Sockets.Pipeline

tier :root,
  accumulator: {Xirsys.Sockets.Accumulator.LengthPrefixed, header_size: 2},
  handler: MyApp.Handlers.Root

tier :inner,
  accumulator: Xirsys.Sockets.Accumulator.Raw,
  handler: MyApp.Handlers.Inner,
  dispatch: :pool,
  pool_size: 8

Summary

Functions

Builds fresh root-tier session maps (used for stateless UDP datagram handling).

Initializes root-tier accumulator and handler state maps for a connection.

Returns true when the pipeline declares more than the mandatory :root tier.

Resolves a compiled pipeline module or legacy {accumulator, handler} sugar into a runtime %Pipeline{} struct.

Returns the %Pipeline.Tier{} specification for a tier key.

Types

t()

@type t() :: %Xirsys.Sockets.Pipeline{
  tiers: %{required(atom()) => Xirsys.Sockets.Pipeline.Tier.t()}
}

Functions

fresh_session(pipeline, opts)

@spec fresh_session(
  t(),
  keyword()
) :: {map(), map()}

Builds fresh root-tier session maps (used for stateless UDP datagram handling).

init_session(pipeline, conn, opts)

@spec init_session(t(), Xirsys.Sockets.Conn.t(), keyword()) :: {map(), map()}

Initializes root-tier accumulator and handler state maps for a connection.

multi_tier?(pipeline)

@spec multi_tier?(t()) :: boolean()

Returns true when the pipeline declares more than the mandatory :root tier.

resolve(pipeline_mod)

@spec resolve(module() | {Xirsys.Sockets.Spec.spec(), module()}) :: t()

Resolves a compiled pipeline module or legacy {accumulator, handler} sugar into a runtime %Pipeline{} struct.

tier_spec(pipeline, key)

@spec tier_spec(t(), atom()) :: Xirsys.Sockets.Pipeline.Tier.t()

Returns the %Pipeline.Tier{} specification for a tier key.