Phase-owned state and transitions for one extension stop operation.
Summary
Functions
Attaches the worker and acknowledgement identity for an editor finalizer.
Records the worker performing termination or cleanup.
Moves to cleanup and records its worker.
Begins lease draining.
Moves directly to editor finalization when no active lease exists.
Moves the stop barrier to editor unload.
Moves the stop operation to runtime termination.
Builds a clean retry after cleanup failed.
Clears a fired or cancelled drain timer.
Records completion of editor effects and merges a finalizer result.
Records an explicit finalizer failure.
Clears completed or failed worker bookkeeping.
Adds another stop caller.
Merges an unload or completion result into finalizer failure state.
Builds an initial quiescing stop transition.
Queues a start intent behind this stop.
Records a terminal-runtime cleanup failure.
Remembers a failed drain request so unload can be aborted correctly.
Replaces the failed-start reason after projection also fails.
Starts a cleanup-only retry for one caller.
Restarts quiescence retry state for one caller.
Records that this stop is rolling back a failed start.
Clears runtime identity after its DOWN arrives during stop.
Marks the code source drained and clears timer ownership.
Replaces stop waiters when a queued stop is transferred from a start.
Types
@type completion() :: :stop | {:start_failure, term(), [GenServer.from()]}
@type queued_start() :: {:current, GenServer.from()} | {:deferred, GenServer.from(), Minga.Extension.Entry.t()}
@type stage() ::
:quiescing
| :draining
| :editor_finalize
| :editor_unload
| :terminating
| :cleanup
@type t() :: %Minga.Extension.Instance.StopContext{ completion: completion(), drain_done?: boolean(), drain_ref: reference() | nil, drain_timer: reference() | nil, editor_done?: boolean(), editor_ref: reference() | nil, exit_kind: :explicit | :normal | :crash, exit_reason: term(), finalizer_error: term() | nil, runtime: Minga.Extension.Instance.Runtime.t() | nil, stage: stage(), start_waiters: [queued_start()], token: reference() | nil, waiters: [GenServer.from()], worker: Minga.Extension.Instance.Worker.t() | nil }
Functions
@spec attach_finalizer(t(), Minga.Extension.Instance.Worker.t()) :: t()
Attaches the worker and acknowledgement identity for an editor finalizer.
@spec attach_worker(t(), Minga.Extension.Instance.Worker.t()) :: t()
Records the worker performing termination or cleanup.
@spec begin_cleanup(t(), Minga.Extension.Instance.Worker.t()) :: t()
Moves to cleanup and records its worker.
Begins lease draining.
Moves directly to editor finalization when no active lease exists.
Moves the stop barrier to editor unload.
Moves the stop operation to runtime termination.
Builds a clean retry after cleanup failed.
Clears a fired or cancelled drain timer.
Records completion of editor effects and merges a finalizer result.
Records an explicit finalizer failure.
Clears completed or failed worker bookkeeping.
@spec join(t(), GenServer.from()) :: t()
Adds another stop caller.
Merges an unload or completion result into finalizer failure state.
@spec new( GenServer.from() | nil, :explicit | :normal | :crash, term(), Minga.Extension.Instance.Runtime.t() | nil ) :: t()
Builds an initial quiescing stop transition.
@spec queue_start(t(), queued_start()) :: t()
Queues a start intent behind this stop.
Records a terminal-runtime cleanup failure.
Remembers a failed drain request so unload can be aborted correctly.
@spec replace_start_failure(t(), term(), [GenServer.from()]) :: t()
Replaces the failed-start reason after projection also fails.
@spec retry_cleanup(t(), GenServer.from()) :: t()
Starts a cleanup-only retry for one caller.
@spec retry_quiescence(t(), GenServer.from()) :: t()
Restarts quiescence retry state for one caller.
@spec rollback_start(t(), term(), [GenServer.from()], [GenServer.from()]) :: t()
Records that this stop is rolling back a failed start.
Clears runtime identity after its DOWN arrives during stop.
Marks the code source drained and clears timer ownership.
@spec transfer_waiters(t(), [GenServer.from()]) :: t()
Replaces stop waiters when a queued stop is transferred from a start.