SquidMesh.Runtime.Dispatcher (squid_mesh v0.1.0-alpha.3)

Copy Markdown View Source

Enqueues durable workflow step execution.

The workflow contract stays declarative while this module bridges runtime intent into Oban-backed execution jobs.

Summary

Types

dispatch_error()

@type dispatch_error() :: Ecto.Changeset.t() | term()

dispatch_event()

@type dispatch_event() ::
  {:run_dispatched, SquidMesh.Run.t(), Oban.Job.t(), atom(),
   pos_integer() | nil}

dispatch_opts()

@type dispatch_opts() :: [{:schedule_in, pos_integer()}]

dispatch_target()

@type dispatch_target() :: atom()

Functions

dispatch_run(config, run, opts \\ [])

@spec dispatch_run(SquidMesh.Config.t(), SquidMesh.Run.t(), dispatch_opts()) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()]} | {:error, dispatch_error()}

dispatch_run_with_events(config, run, opts \\ [])

@spec dispatch_run_with_events(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  dispatch_opts()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()], [dispatch_event()]}
  | {:error, dispatch_error()}

dispatch_steps(config, run, steps, opts \\ [])

@spec dispatch_steps(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  [dispatch_target()],
  keyword()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()]} | {:error, dispatch_error()}

dispatch_steps_with_events(config, run, steps, opts \\ [])

@spec dispatch_steps_with_events(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  [dispatch_target()],
  keyword()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()], [dispatch_event()]}
  | {:error, dispatch_error()}