minato_sup (minato v1.2.0)

View Source

The supervisor over the pools.

Pools declared in the application environment are started here, so an application whose database is not up yet still starts: a pool is up before it has connections, and fills in the background.

{minato, [{pools, #{main => #{size => 10, connection => #{user => ~"minato"}}}},
          {listeners, #{events => #{connection => #{user => ~"minato"}}}}]}

start_pool/2 and start_listener/2 add one at run time. A pool is one_for_one and permanent: it holds sockets, and a pool that died and stayed dead would take every caller with it.

Summary

Functions

Whether a name is one of minato's own and so not a pool's or a listener's.

Start the supervisor and every pool the environment declares.

Add a listener at run time. The same names are reserved as for a pool.

Add a pool at run time.

Stop a listener and forget it.

Stop a pool and forget it.

Functions

reserved/1

-spec reserved(term()) -> boolean().

Whether a name is one of minato's own and so not a pool's or a listener's.

minato_overdue is the child that bounds TLS writes and minato_sup is this supervisor. A pool under either name would be mistaken for it: started, it would answer with the pid of a process that is not a pool, and stopped, it would take that process with it.

start_link()

-spec start_link() -> supervisor:startlink_ret().

Start the supervisor and every pool the environment declares.

start_listener(Name, Opts)

Add a listener at run time. The same names are reserved as for a pool.

start_pool(Name, Opts)

Add a pool at run time.

{error, {reserved_name, Name}} for a name minato's own processes are registered under and kept by: see reserved/1.

stop_listener(Name)

-spec stop_listener(minato_listener:name()) -> ok | {error, not_found}.

Stop a listener and forget it.

stop_pool(Name)

-spec stop_pool(minato_pool:name()) -> ok | {error, not_found}.

Stop a pool and forget it.