Lifecycle, admission-policy, and worker coordination for EffectScheduler.
Summary
Functions
Returns whether a handler has running, queued, or pending work.
Returns whether any active request advertises a semantic activity.
Returns whether a source has running, queued, or pending work.
Returns whether an exact request still holds scheduler admission.
Attaches the scheduler's single owner.
Cancels an admitted request.
Cancels the admitted request correlated with a semantic operation.
Cancels and terminalizes all work for one semantic resource.
Cancels and terminalizes all work attributed to a contribution source.
Atomically claims a still-pending candidate without releasing its resource.
Finalizes a domain-applied candidate, if it is still pending.
Finalizes a candidate and admits its follow-up as one scheduler transition.
Processes an owner or worker DOWN message.
Admits a request according to its resource policy.
Stops all work and terminalizes every admitted request.
Returns bounded scheduler statistics.
Processes a successful worker reply.
Processes a scheduler-owned request timeout.
Types
@type admission() :: {:ok, MingaEditor.Effect.Request.id(), :running | :queued} | {:error, admission_error()}
@type admission_error() ::
:already_admitted
| :owner_unavailable
| :policy_mismatch
| :queue_full
| :scheduler_full
@type claim() :: :ok | {:error, :not_pending}
@type handoff() :: admission() | {:error, :not_found}
Functions
@spec active?(MingaEditor.EffectScheduler.State.t(), module()) :: boolean()
Returns whether a handler has running, queued, or pending work.
@spec active_activity?(MingaEditor.EffectScheduler.State.t(), atom()) :: boolean()
Returns whether any active request advertises a semantic activity.
@spec active_source?( MingaEditor.EffectScheduler.State.t(), Minga.Extension.ContributionCleanup.contribution_source() ) :: boolean()
Returns whether a source has running, queued, or pending work.
@spec admitted?( MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Request.id() ) :: boolean()
Returns whether an exact request still holds scheduler admission.
@spec attach(MingaEditor.EffectScheduler.State.t(), pid()) :: {:ok | {:error, :already_attached}, MingaEditor.EffectScheduler.State.t()}
Attaches the scheduler's single owner.
@spec cancel(MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Request.id()) :: {:ok | {:error, :not_found}, MingaEditor.EffectScheduler.State.t()}
Cancels an admitted request.
@spec cancel_operation( MingaEditor.EffectScheduler.State.t(), MingaEditor.State.Operation.id() ) :: {:ok | {:error, :not_found}, MingaEditor.EffectScheduler.State.t()}
Cancels the admitted request correlated with a semantic operation.
@spec cancel_resource( MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Request.resource() ) :: {:ok, MingaEditor.EffectScheduler.State.t()}
Cancels and terminalizes all work for one semantic resource.
@spec cancel_source( MingaEditor.EffectScheduler.State.t(), Minga.Extension.ContributionCleanup.contribution_source() ) :: {:ok, MingaEditor.EffectScheduler.State.t()}
Cancels and terminalizes all work attributed to a contribution source.
@spec claim(MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Outcome.t()) :: {claim(), MingaEditor.EffectScheduler.State.t()}
Atomically claims a still-pending candidate without releasing its resource.
@spec finalize(MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Outcome.t()) :: MingaEditor.EffectScheduler.State.t()
Finalizes a domain-applied candidate, if it is still pending.
@spec finalize_and_schedule( MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Outcome.t(), MingaEditor.Effect.Request.t() ) :: {handoff(), MingaEditor.EffectScheduler.State.t()}
Finalizes a candidate and admits its follow-up as one scheduler transition.
@spec process_down(MingaEditor.EffectScheduler.State.t(), reference(), pid(), term()) :: MingaEditor.EffectScheduler.State.t()
Processes an owner or worker DOWN message.
@spec schedule(MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Request.t()) :: {admission(), MingaEditor.EffectScheduler.State.t()}
Admits a request according to its resource policy.
@spec shutdown(MingaEditor.EffectScheduler.State.t(), term()) :: MingaEditor.EffectScheduler.State.t()
Stops all work and terminalizes every admitted request.
@spec stats(MingaEditor.EffectScheduler.State.t()) :: map()
Returns bounded scheduler statistics.
@spec task_result(MingaEditor.EffectScheduler.State.t(), reference(), term()) :: MingaEditor.EffectScheduler.State.t()
Processes a successful worker reply.
@spec timeout(MingaEditor.EffectScheduler.State.t(), MingaEditor.Effect.Request.id()) :: MingaEditor.EffectScheduler.State.t()
Processes a scheduler-owned request timeout.