MingaEditor.EffectScheduler.State (Minga v0.1.0)

Copy Markdown View Source

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.

t()

Functions

Builds initial scheduler state from validated process options.

Types

lane()

@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.

running()

@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.

t()

@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

new(task_supervisor, observer, max_admitted)

@spec new(GenServer.server(), pid() | nil, pos_integer()) :: t()

Builds initial scheduler state from validated process options.