arizona_sup (arizona v0.4.0)
View SourceTop-level supervisor for the Arizona application.
Always supervises arizona_pubsub (the pg-based pubsub scope) and
arizona_mcp_sup (the MCP session supervisor, which owns the session
registry and starts per-session processes on demand), and owns the hot
reloader's beam-facts cache table (arizona_reloader_consistency:create_table/0,
created in init/1 so the cache outlives the short-lived processes that read
it) and the dev MCP's log ring table (arizona_dev_log:create_table/0, for the
same reason). Also supervises arizona_reloader_sup (one
arizona_reloader_rule per rule) when the dev-mode reloader has rules in the
reloader application env, and the configured server-side session store when
the session_store env names a backend that exports child_spec/0 (e.g.
arizona_session_store_ets). Live processes are not managed here -- they're
started ad hoc by the transport layer (arizona_socket:init/4) and linked
to the calling WebSocket process so they share its lifetime.
Reloader config
{arizona, [
{reloader, #{
enabled => true,
watcher => arizona_watcher_fs,
rules => [
#{directory => "src",
patterns => [".*\\.erl$"],
callback => fun arizona_reloader:reload_erl/1}
]
}}
]}arizona_reloader_rule:child_specs/1 turns the rules into one rule process
each, under arizona_reloader_sup, run by the watcher (an arizona_watcher
implementation, from a dev-only dependency). Malformed config (missing
directory or watcher, a watcher that is not on the code path) crashes the
supervisor init so boot errors are obvious.
Summary
Functions
-spec init(Args) -> {ok, {SupFlags, [ChildSpec]}} when Args :: map(), SupFlags :: supervisor:sup_flags(), ChildSpec :: supervisor:child_spec().
-spec start_link() -> supervisor:startlink_ret().
Starts the supervisor under the well-known name arizona_sup.