Dsxir.Program (dsxir v0.1.0)

Copy Markdown

Runtime state container for a user program.

Carries a reference to the user module, a per-predictor State map, and an open metadata map populated by optimizers. Flows explicitly through forward/2 and Dsxir.Module.Runtime.call/4 — never held as ambient state.

Summary

Functions

Fetch the per-predictor State slot, raising if name is unknown.

Build a fresh program for user_module. Raises Dsxir.Errors.Invalid.Module when the module is not a Dsxir.Module.

Build a program with explicit predictor names (used internally by load).

Replace the State for name in prog, returning the updated program.

Types

t()

@type t() :: %Dsxir.Program{
  metadata: map(),
  module: module(),
  predictors: %{required(atom()) => Dsxir.Program.State.t()}
}

Functions

get_state(program, name)

@spec get_state(t(), atom()) :: Dsxir.Program.State.t()

Fetch the per-predictor State slot, raising if name is unknown.

new(user_module)

@spec new(module()) :: t()

Build a fresh program for user_module. Raises Dsxir.Errors.Invalid.Module when the module is not a Dsxir.Module.

new(user_module, predictor_names)

@spec new(module(), [atom()]) :: t()

Build a program with explicit predictor names (used internally by load).

put_state(prog, name, state)

@spec put_state(t(), atom(), Dsxir.Program.State.t()) :: t()

Replace the State for name in prog, returning the updated program.