Anubis.Server.Registry behaviour
(anubis_mcp v1.0.0)
Copy Markdown
Behaviour for pluggable session registries and deterministic naming utilities.
The registry is responsible for mapping session IDs to PIDs. Different transports have different needs:
- STDIO: single session, no registry needed (
Registry.None) - HTTP: multiple sessions, need lookup by session ID (
Registry.Local)
Naming Utilities
The module also provides deterministic atom naming for internal processes. These are safe because server modules are compile-time bounded.
Summary
Types
@type session_id() :: String.t()
Callbacks
@callback child_spec(keyword()) :: Supervisor.child_spec() | :ignore
@callback lookup_session(name :: term(), session_id()) :: {:ok, pid()} | {:error, :not_found}
@callback register_session(name :: term(), session_id(), pid()) :: :ok | {:error, term()}
@callback unregister_session(name :: term(), session_id()) :: :ok