Search documentation of macula

# macula_peer_system (macula v0.44.2)

View Source

Peer 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

init(_)

Initialize the supervisor with child specifications.

start_link(Url, Opts)

Start the peer system supervisor with given URL and options.

stop(Sup)

Stop the peer system supervisor and all children.

# Functions

# init(_)

    -spec init({binary(), map()}) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.

Initialize the supervisor with child specifications.

# start_link(Url, Opts)

    -spec start_link(binary(), map()) -> {ok, pid()} | {error, term()}.

Start the peer system supervisor with given URL and options.

# stop(Sup)

    -spec stop(pid()) -> ok.

Stop the peer system supervisor and all children.