Pure lifecycle state and phase transitions for one extension Instance.
Summary
Functions
Returns the prepared artifact when available.
Moves the authority to cleanup-failed with a resumable stop context.
Replaces per-request lifecycle collaborators while retaining stable injections.
Moves the authority to a terminal crash phase.
Removes projection fields from a registry snapshot.
Updates declaration identity and collaborators while no transition is active.
Increments the authority-owned crash restart count.
Adds a caller to a transition's stop waiter list.
Moves the authority to a terminal load-error phase.
Constructs a stopped lifecycle state from its declaration.
Stores the immutable current-generation artifact.
Queues a start intent behind a safe stop.
Replaces the reason of the current terminal failure phase.
Moves the authority into the running phase.
Returns runtime identity only from phases that own it.
Removes request-scoped callbacks and timeout overrides.
Moves the authority into a start transition.
Moves the authority to a terminal stopped phase.
Moves the authority into a stop transition with an existing context.
Builds the initial asynchronous stop context.
Moves the authority to the lazy stub phase.
Applies the terminal phase implied by a completed stop context.
Types
@type phase() :: :stopped | {:stub, Minga.Extension.Instance.Artifact.t()} | {:starting, Minga.Extension.Instance.StartContext.t()} | {:running, Minga.Extension.Instance.Runtime.t()} | {:stopping, Minga.Extension.Instance.StopContext.t()} | {:crashed, Minga.Extension.Instance.PhaseFailure.t()} | {:load_error, Minga.Extension.Instance.PhaseFailure.t()} | {:cleanup_failed, Minga.Extension.Instance.CleanupFailure.t()}
@type queued_start() :: {:current, GenServer.from()} | {:deferred, GenServer.from(), Minga.Extension.Entry.t()}
@type t() :: %Minga.Extension.Instance.State{ artifact: :unprepared | {:prepared, Minga.Extension.Instance.Artifact.t()}, collaborators: keyword(), declaration: Minga.Extension.Entry.t(), instance_registry: atom(), name: atom(), phase: phase(), registry: GenServer.server(), restart_count: non_neg_integer() }
Functions
@spec artifact(t()) :: {:ok, Minga.Extension.Instance.Artifact.t()} | :error
Returns the prepared artifact when available.
@spec cleanup_failed(t(), term(), Minga.Extension.Instance.StopContext.t()) :: t()
Moves the authority to cleanup-failed with a resumable stop context.
Replaces per-request lifecycle collaborators while retaining stable injections.
Moves the authority to a terminal crash phase.
@spec declaration_only(Minga.Extension.Entry.t()) :: Minga.Extension.Entry.t()
Removes projection fields from a registry snapshot.
@spec declare(t(), Minga.Extension.Entry.t(), GenServer.server(), keyword()) :: {:ok, t()} | {:error, term()}
Updates declaration identity and collaborators while no transition is active.
Increments the authority-owned crash restart count.
@spec join_stop(t(), GenServer.from()) :: t()
Adds a caller to a transition's stop waiter list.
Moves the authority to a terminal load-error phase.
@spec new(atom(), Minga.Extension.Entry.t(), GenServer.server(), atom(), keyword()) :: t()
Constructs a stopped lifecycle state from its declaration.
@spec put_artifact(t(), Minga.Extension.Instance.Artifact.t()) :: t()
Stores the immutable current-generation artifact.
@spec queue_start(t(), queued_start()) :: t()
Queues a start intent behind a safe stop.
Replaces the reason of the current terminal failure phase.
@spec running(t(), Minga.Extension.Instance.Runtime.t()) :: t()
Moves the authority into the running phase.
@spec runtime(phase()) :: Minga.Extension.Instance.Runtime.t() | nil
Returns runtime identity only from phases that own it.
Removes request-scoped callbacks and timeout overrides.
@spec starting(t(), Minga.Extension.Instance.StartContext.t()) :: t()
Moves the authority into a start transition.
Moves the authority to a terminal stopped phase.
@spec stopping(t(), Minga.Extension.Instance.StopContext.t()) :: t()
Moves the authority into a stop transition with an existing context.
@spec stopping(t(), GenServer.from() | nil, :explicit | :normal | :crash, term()) :: t()
Builds the initial asynchronous stop context.
@spec stubbed(t(), Minga.Extension.Instance.Artifact.t()) :: t()
Moves the authority to the lazy stub phase.
@spec terminal(t(), Minga.Extension.Instance.StopContext.t()) :: t()
Applies the terminal phase implied by a completed stop context.