Spectre.GAM.Domain (Spectre v0.4.0)

Copy Markdown View Source

Runtime handle for one governed Domain.

The handle is deliberately not a durable record. Authority lives in the Domain ledger; the pid merely serializes commands against that ledger. Each running Domain is wired to one validated Spectre.GAM.Ingress adapter, whose stable reference fences every authenticated submission context.

Public workflows enter through Spectre.GAM; Domain.Sequencer is the ordered mailbox, and the modules below Domain.Command own the individual I/O workflows. Governed semantics do not live in this handle or in callbacks: they are evaluated by Spectre.GAM.Kernel and replayed by Spectre.GAM.GovernedAct.Fold.

For a static application topology, put {Spectre.GAM.Domain, opts} after its store in the host supervisor. opts includes :domain_ref, :store and the same foundation/boundary options accepted by Spectre.GAM.start_domain/3. :rest_for_one restarts the Domain after an earlier store child fails; the store's own durability determines what survives. Resolve the registered handle with Spectre.GAM.lookup_domain/1 after startup. The default Registry is provided by the Spectre.GAM application.

Use Spectre.GAM.start_domain/3 for dynamically provisioned Domains under Spectre.GAM's supervisor instead. Do not start the same Domain in both trees. Neither form authenticates a Scope or creates an Instance automatically.

Summary

Types

t()

Transparent runtime address, not proof of identity or authority.

Functions

Declares one Domain as a permanent, uniquely identified child of a host supervisor.

Constructs a runtime address; it does not verify that the process owns this Domain or grant access.

Starts and registers a Domain linked to the caller, with explicit foundation and adapter options.

Returns the locally supervised process for a Domain reference.

Types

t()

@type t() :: %Spectre.GAM.Domain{ref: String.t(), server: GenServer.server()}

Transparent runtime address, not proof of identity or authority.

Callers and facade workflows may inspect this data. Governed operations resolve the registered Domain and verify the submission context; neither constructing nor editing a handle bypasses those checks.

Functions

child_spec(opts)

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

Declares one Domain as a permanent, uniquely identified child of a host supervisor.

handle(server, ref)

@spec handle(GenServer.server(), String.t()) :: t()

Constructs a runtime address; it does not verify that the process owns this Domain or grant access.

start_link(opts)

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

Starts and registers a Domain linked to the caller, with explicit foundation and adapter options.

whereis(ref, registry \\ Spectre.GAM.Domain.Registry)

@spec whereis(String.t(), atom()) :: pid() | nil

Returns the locally supervised process for a Domain reference.