Typed process state for the editor-owned slow-effect scheduler.
Summary
Types
One resource lane with a stable scheduling policy.
A running request and its supervised worker, if the worker started.
Functions
Builds initial scheduler state from validated process options.
Types
@type lane() :: %{ policy: MingaEditor.Effect.Policy.t(), running: running() | nil, queue: :queue.queue(MingaEditor.Effect.Request.t()) }
One resource lane with a stable scheduling policy.
@type running() :: %{ task: Task.t() | nil, request: MingaEditor.Effect.Request.t(), timer: reference() | nil }
A running request and its supervised worker, if the worker started.
@type t() :: %MingaEditor.EffectScheduler.State{ admitted: MapSet.t(MingaEditor.Effect.Request.id()), claimed: MapSet.t(MingaEditor.Effect.Request.id()), lanes: %{optional(MingaEditor.Effect.Request.resource()) => lane()}, max_admitted: pos_integer(), observer: pid() | nil, owner: pid() | nil, owner_monitor: reference() | nil, pending: %{ optional(MingaEditor.Effect.Request.id()) => MingaEditor.Effect.Outcome.t() }, task_supervisor: GenServer.server(), tasks: %{optional(reference()) => MingaEditor.Effect.Request.resource()}, timers: %{optional(reference()) => MingaEditor.Effect.Request.id()} }
Functions
@spec new(GenServer.server(), pid() | nil, pos_integer()) :: t()
Builds initial scheduler state from validated process options.