quic_discovery_static (quic v1.3.1)

View Source

Static node discovery backend.

This backend uses a static list of nodes configured in the application environment or vm.args.

Configuration

In sys.config:

   {quic, [
     {dist, [
       {discovery_module, quic_discovery_static},
       {nodes, [
         {'node1@host1', {"192.168.1.1", 4433}},
         {'node2@host2', {"192.168.1.2", 4433}}
       ]}
     ]}
   ]}

In vm.args:

   -quic_dist nodes [{'node1@host1',{"192.168.1.1",4433}}]

Summary

Functions

Initialize the static discovery backend.

List all known nodes.

Look up a node's address.

Register a node with its address directly. This is a simplified API for manual registration during testing or when you need to add a node outside of the behaviour callback. Address can be {IP, Port} where IP is a tuple or string.

Register a node in the static table. This allows runtime updates to the node list.

Unregister a node.

Functions

init(Opts)

-spec init(Opts :: proplists:proplist() | map()) -> {ok, map()}.

Initialize the static discovery backend.

list_nodes(Host)

-spec list_nodes(Host :: string()) -> {ok, [{atom(), inet:port_number()}]}.

List all known nodes.

lookup(NodeName, Host)

-spec lookup(NodeName :: atom(), Host :: string()) ->
                {ok, {inet:ip_address() | string(), inet:port_number()}} | {error, not_found}.

Look up a node's address.

register(NodeName, Address)

-spec register(NodeName :: atom(), Address :: {inet:ip_address() | string(), inet:port_number()}) -> ok.

Register a node with its address directly. This is a simplified API for manual registration during testing or when you need to add a node outside of the behaviour callback. Address can be {IP, Port} where IP is a tuple or string.

register(NodeName, Port, State)

-spec register(NodeName :: atom(), Port :: inet:port_number(), State :: map()) -> {ok, map()}.

Register a node in the static table. This allows runtime updates to the node list.

unregister(NodeName)

-spec unregister(NodeName :: atom()) -> ok.

Unregister a node.