macula_peer_system (macula v0.20.5)
View SourcePeer System Supervisor - supervises the peer subsystem.
Supervision Strategy: - rest_for_one: If child N crashes, restart N and all children after N - Rationale: connection_manager is foundational; handlers depend on it but are independent of each other. This provides fault isolation while maintaining consistency when connection_manager restarts.
Architecture:
macula_peer_system (this module)
├── macula_connection - QUIC connection lifecycle (transport layer)
├── macula_pubsub_handler - Pub/sub operations
├── macula_rpc_handler - RPC operations
└── macula_advertisement_manager - DHT service advertisements
Children (in dependency order): - macula_connection: QUIC connection lifecycle (foundational) - macula_pubsub_handler: Pub/sub operations (depends on connection) - macula_rpc_handler: RPC operations (depends on connection) - macula_advertisement_manager: DHT advertisements (depends on connection)
Fault Isolation: - advertisement_manager crash → only advertisement restarts - rpc_handler crash → rpc + advertisement restart - pubsub_handler crash → pubsub + rpc + advertisement restart - connection crash → all restart (unavoidable - foundational)
Renamed from macula_connection_sup (v0.7.10) to align with macula_peer nomenclature and macula_gateway_system naming convention.
Summary
Functions
Initialize the supervisor with child specifications.
Start the peer system supervisor with given URL and options.
Stop the peer system supervisor and all children.
Functions
-spec init({binary(), map()}) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.
Initialize the supervisor with child specifications.
Start the peer system supervisor with given URL and options.
-spec stop(pid()) -> ok.
Stop the peer system supervisor and all children.