quic_server_registry (quic v1.3.1)
View SourceETS-based registry for named QUIC server lookup.
This module provides a registry for named QUIC servers, allowing lookup of server information by name. The registry monitors server processes and automatically removes them when they terminate.
Usage
%% Register a server
ok = quic_server_registry:register(my_server, Pid, 4433, Opts).
%% Look up a server
{ok, #{pid := Pid, port := 4433}} = quic_server_registry:lookup(my_server).
%% List all servers
[my_server] = quic_server_registry:list().
Summary
Functions
Get the connection PIDs for a named server.
Get the port for a named server. If the server was started with port 0, queries the actual bound port from a listener and updates the registry for future lookups.
List all registered server names.
Look up a server by name.
Register a named server.
Start the server registry.
Unregister a named server.
Update the port for a named server. Used when a server was started with port 0 and we've discovered the actual port.
Functions
Get the connection PIDs for a named server.
-spec get_port(atom()) -> {ok, inet:port_number()} | {error, not_found}.
Get the port for a named server. If the server was started with port 0, queries the actual bound port from a listener and updates the registry for future lookups.
-spec list() -> [atom()].
List all registered server names.
Look up a server by name.
-spec register(atom(), pid(), inet:port_number(), map()) -> ok.
Register a named server.
Start the server registry.
-spec unregister(atom()) -> ok.
Unregister a named server.
-spec update_port(atom(), inet:port_number()) -> ok | {error, not_found}.
Update the port for a named server. Used when a server was started with port 0 and we've discovered the actual port.