Search documentation of macula

# macula_bridge_mesh (macula v0.44.2)

View Source

Macula Bridge Mesh - Manages mesh formation with peer bridges.

Bridge Nodes at the same level form their own mesh with a shared DHT. This enables horizontal discovery at each mesh level.

The mesh provides: - Peer bridge discovery via mDNS or explicit configuration - Shared DHT at this level (queries can be answered by any bridge) - Load balancing for query handling - Redundancy if one bridge fails

# Summary

## Types

peer_info/0

## Functions

add_peer(Pid, PeerInfo)

Add a peer bridge to the mesh.

broadcast(Pid, Message)

Broadcast message to all peer bridges.

get_peers(Pid)

Get list of connected peer bridges.

get_stats(Pid)

Get mesh statistics.

handle_call(Request, From, State)
handle_cast(Request, State)
handle_info(Info, State)
init(Config)
query_peer(Pid, PeerId, Query)

Query a specific peer bridge.

remove_peer(Pid, PeerId)

Remove a peer bridge from the mesh.

start_link(Config)

Start bridge mesh with registered name.

terminate(Reason, State)

# Types

# peer_info/0

    -type peer_info() ::
              #{endpoint => binary(),
                connected_at => integer(),
                last_seen => integer(),
                queries_handled => non_neg_integer()}.

# Functions

# add_peer(Pid, PeerInfo)

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

Add a peer bridge to the mesh.

# broadcast(Pid, Message)

    -spec broadcast(pid(), term()) -> ok.

Broadcast message to all peer bridges.

# get_peers(Pid)

    -spec get_peers(pid()) -> [peer_info()].

Get list of connected peer bridges.

# get_stats(Pid)

    -spec get_stats(pid()) -> {ok, map()}.

Get mesh statistics.

# handle_call(Request, From, State)

# handle_cast(Request, State)

# handle_info(Info, State)

# init(Config)

# query_peer(Pid, PeerId, Query)

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

Query a specific peer bridge.

# remove_peer(Pid, PeerId)

    -spec remove_peer(pid(), binary()) -> ok.

Remove a peer bridge from the mesh.

# start_link(Config)

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

Start bridge mesh with registered name.

# terminate(Reason, State)