Fnord.Instance (fnord v0.9.37)

View Source

A checked-out application instance: a supervision tree carrying its own config scope and its own copies of fnord's services.

start_link/1 installs the calling process as a Services.Globals root, applies the given config as tree-local overrides, and starts the service roster under a supervisor. Everything spawned beneath the caller resolves config and services from that root, so multiple instances in one BEAM (e.g. tests) are mutually invisible.

The caller owns the instance: when it exits, the supervisor (and all services under it) shut down with it, and Services.Globals wipes the root's config overrides and service registrations.

This is the single boot path: production (Fnord.main/1) and tests (Fnord.TestCase setup) both check out an instance. NamePool and Approvals read config at call time (their inits read nothing), so no second config-dependent boot phase exists. Not in the roster: per-conversation servers (Services.Task, started by Cmd.Ask with a conversation pid), Services.MemoryIndexer (session-lazy, started by Cmd.Ask), UI.Tee (started only under --tee), and the MCP stack (atom-named by the hermes library; see docs/dev/gotchas.md).

Summary

Functions

Returns a specification to start this module under a supervisor.

Check out an instance owned by the calling process.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

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

Check out an instance owned by the calling process.

Options:

  • :config - keyword list of :fnord config applied as tree-local overrides before any service starts, so services boot with their invocation config already resolved.