Minga.Extension.Instance (Minga v0.1.0)

Copy Markdown View Source

Stable per-extension lifecycle authority.

Public requests, runtime exits, drain events, and finalizer acknowledgements share this one mailbox. Handler modules compute transitions, while this sole GenServer owns message ordering and lifecycle authority.

Summary

Functions

Builds the permanent authority child spec.

Updates the declaration snapshot used by later transitions.

Projects a bulk prerequisite failure through the lifecycle authority.

Prepares and captures the declaration artifact and returns its load policy.

Returns the tagged authority phase for diagnostics and focused tests.

Starts or joins the extension's current start transition.

Starts only when the captured deferred declaration is still current.

Starts one named lifecycle authority.

Stops or joins the extension's current stop transition.

Registers a lazy stub through this authority.

Types

result()

@type result() :: {:ok, pid()} | {:error, term()}

server()

@type server() :: GenServer.server()

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Builds the permanent authority child spec.

declare(server, declaration, registry, opts)

@spec declare(server(), Minga.Extension.Entry.t(), GenServer.server(), keyword()) ::
  :ok | {:error, term()}

Updates the declaration snapshot used by later transitions.

fail_start(server, reason)

@spec fail_start(server(), term()) :: {:error, term()}

Projects a bulk prerequisite failure through the lifecycle authority.

load_policy(server)

@spec load_policy(server()) :: {:ok, Minga.Extension.load_policy()} | {:error, term()}

Prepares and captures the declaration artifact and returns its load policy.

phase(server)

Returns the tagged authority phase for diagnostics and focused tests.

start(server)

@spec start(server()) :: result()

Starts or joins the extension's current start transition.

start_deferred(server, declaration)

@spec start_deferred(server(), Minga.Extension.Entry.t()) :: result()

Starts only when the captured deferred declaration is still current.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts one named lifecycle authority.

stop(server, opts \\ [])

@spec stop(
  server(),
  keyword()
) :: :ok | {:error, term()}

Stops or joins the extension's current stop transition.

stub(server)

@spec stub(server()) :: :ok | {:error, term()}

Registers a lazy stub through this authority.