Oi.Dispatch.Config (oi v0.6.3)

Copy Markdown

Immutable dispatch configuration.

Built once at the dispatch boundary, threaded to Worker and the plugin chain. Controls executor selection, concurrency, timeout, and Orchid plugin pipeline.

Options

  • :executor — module implementing Oi.Executor (default: Oi.Executor.Sync)
  • :executor_opts — keyword opts passed to executor's run/3
  • :orchid_adapters — ordered list of fn {recipe, opts}, conf -> {recipe, opts} adapters
  • :orchid_baggage — map merged into every Orchid run's baggage
  • :orchid_opts — extra keyword opts forwarded to Orchid.run/3
  • :concurrency — fallback for executor if :executor_opts has none
  • :timeout — fallback for executor if :executor_opts has none

Summary

Types

Unified user-facing data for Oi.execute/2.

t()

Functions

Run every plugin in order over the {recipe, run_opts} tuple. Each plugin may rewrite the recipe or append to run_opts.

Assemble keyword opts for Orchid.run/3. Delegates to Options.assemble_run_opts/3.

Build a Drafting from user :data and compiled graph topology. Delegates to Options.build_drafting_inputs/2.

Types

data()

@type data() :: map()

Unified user-facing data for Oi.execute/2.

Two formats supported:

  • Tuple keys: %{{:step1, :in} => "foo", {:step2, :out} => {:override, "bar"}}
  • Nested: %{step1: %{in: "foo"}, step2: %{out: {:override, "bar"}}}

t()

@type t() :: %Oi.Dispatch.Config{
  concurrency: pos_integer(),
  data: map(),
  executor: module(),
  executor_opts: keyword(),
  name: Oi.name() | nil,
  orchid_adapters: [
    ({Orchid.Recipe.t(), keyword()}, t() -> {Orchid.Recipe.t(), keyword()})
    | ({Orchid.Recipe.t(), keyword()} -> {Orchid.Recipe.t(), keyword()})
  ],
  orchid_baggage: map(),
  orchid_opts: keyword(),
  timeout: timeout()
}

Functions

apply_orchid_adapters(conf, orchid_tuple)

@spec apply_orchid_adapters(
  t(),
  {Orchid.Recipe.t(), keyword()}
) :: {Orchid.Recipe.t(), keyword()}

Run every plugin in order over the {recipe, run_opts} tuple. Each plugin may rewrite the recipe or append to run_opts.

assemble_run_opts(conf, drafting)

@spec assemble_run_opts(t(), Oi.Dispatch.Drafting.t()) :: keyword()

Assemble keyword opts for Orchid.run/3. Delegates to Options.assemble_run_opts/3.

build_drafting(conf, compiled)

@spec build_drafting(t(), Oi.Compiled.t()) ::
  {:ok, Oi.Dispatch.Drafting.t()} | {:error, term()}

Build a Drafting from user :data and compiled graph topology. Delegates to Options.build_drafting_inputs/2.

new(opts \\ [])

@spec new(keyword()) :: t()