macula_gateway_system (macula v0.20.5)

View Source

Gateway Root Supervisor - top-level supervisor for gateway subsystem.

Supervision Strategy: - rest_for_one: Dependency-based restart ordering - Child order reflects dependencies: 1. quic_server (owns QUIC listener, no dependencies) 2. gateway (depends on quic_server PID) 3. workers_sup (depends on gateway PID)

Fault Isolation: - quic_server crash → restart quic_server, gateway, workers_sup - gateway crash → restart gateway, workers_sup (quic_server continues) - workers_sup crash → restart workers_sup only (quic_server and gateway continue)

Architecture:

   macula_gateway_system (this module)
    macula_gateway_health        - Health check HTTP server
    macula_gateway_diagnostics   - Diagnostics service
    macula_gateway_quic_server   - QUIC transport layer
    macula_gateway               - Message routing coordinator
    macula_gateway_workers_sup   - Business logic workers
        macula_gateway_clients   - Client tracking
        macula_gateway_pubsub    - Pub/Sub routing
        macula_gateway_rpc       - RPC handling
        macula_gateway_mesh      - Mesh connections
   

Circular Dependency Resolution: - quic_server starts first (without gateway PID) - gateway starts second (receives quic_server PID) - Supervisor calls quic_server:set_gateway/1 to complete link - workers_sup starts last (receives gateway PID)

Created during Phase 2 QUIC refactoring to enable proper OTP supervision.

Summary

Functions

Start the root gateway supervisor with configuration.

Functions

init(Opts)

start_link(Opts)

-spec start_link(proplists:proplist()) -> {ok, pid()} | {error, term()}.

Start the root gateway supervisor with configuration.