Mcp42.SessionRegistry (mcp42 v0.1.0)

Copy Markdown

ETS-backed session registry: Mcp-Session-Id -> session pid.

Reads go straight to a public ETS table (no GenServer hop on the request path); writes go through a GenServer that monitors every registered pid and removes entries on :DOWN.

Summary

Functions

Returns a specification to start this module under a supervisor.

{:ok, pid} or :error when the id is unknown.

Register pid under session_id. Idempotent overwrite of the id.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

lookup(session_id)

@spec lookup(String.t()) :: {:ok, pid()} | :error

{:ok, pid} or :error when the id is unknown.

register(session_id, pid)

@spec register(String.t(), pid()) :: :ok

Register pid under session_id. Idempotent overwrite of the id.

start_link(opts \\ [])