Behaviours: supervisor.
Authors: Steve Roques.
em_filter Top-Level Supervisor
Manages the em_filter_server worker pool and the em_pop Population Protocol sub-supervisor.
Strategy: one_for_one.
• em_pop_sup — permanent child, started at application boot.
• em_filter_server workers — added dynamically via start_agent/3,
each with its own unique child id.
When start_agent/3 is called, one em_filter_server worker is
started per configured disco node. If the Config map contains a
pop_port key, an em_pop Population Protocol node is also started
and registered in em_pop_sup's ETS registry.
nodes = localhost:8080, disco.example.com
Port resolution (when no port is given): localhost / 127.0.0.1 → 8080, plain TCP any other host → 443, TLS
Explicit port always wins: localhost:9000 → 9000, plain TCP example.com:8080 → 8080, plain TCP example.com:443 → 443, TLS
| start_agent/3 | Starts one worker per configured disco node for the agent. |
| start_link/0 | |
| stop_agent/1 | Stops all workers and the em_pop node for the given agent. |
start_agent(AgentName::atom(), HandlerModule::module(), Config::map()) -> {ok, pid()} | {error, term()}
AgentName: Unique atom identifying the agent.
HandlerModule: Module exporting handle/2.
Config: Agent options map.
Starts one worker per configured disco node for the agent.
Node list is taken from (in priority order):
1. disco_nodes key in Config map (useful for testing)
2. EM_DISCO_HOST / EM_DISCO_PORT environment variables
3. [em_disco] nodes = ... in emergence.conf
4. Default: [{"localhost", 8080, tcp}]
If Config contains pop_port, an em_pop node is also started and
the capability vector is derived from the capabilities list.
{ok, Pid} of the first successfully started worker.
start_link() -> {ok, pid()} | {error, term()}
stop_agent(AgentName::atom()) -> ok | {error, not_running}
Stops all workers and the em_pop node for the given agent.
Returns{error, not_running} if no matching worker is found.
Generated by EDoc