macula_bridge_node (macula v0.14.3)

View Source

Macula Bridge Node - Manages connection to parent mesh level.

The Bridge Node is responsible for: - Connecting to parent mesh (street to neighborhood to city to etc.) - Escalating DHT queries when local DHT misses - Caching results from parent queries locally - Maintaining connection health to parent bridges

Summary

Functions

Escalate a DHT query to parent level. Called when local DHT lookup fails.

Get list of parent bridge endpoints.

Get bridge node statistics.

Check if connected to parent bridge.

Update parent bridge endpoints (for dynamic configuration).

Start bridge node with registered name.

Store value to parent DHT (for advertisement propagation).

Functions

escalate_query(Pid, Query)

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

Escalate a DHT query to parent level. Called when local DHT lookup fails.

escalate_query(Pid, Query, Timeout)

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

get_parent_bridges(Pid)

-spec get_parent_bridges(pid()) -> [binary()].

Get list of parent bridge endpoints.

get_stats(Pid)

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

Get bridge node statistics.

handle_call(Request, From, State)

handle_cast(Request, State)

handle_info(Info, State)

init(Config)

is_connected(Pid)

-spec is_connected(pid()) -> boolean().

Check if connected to parent bridge.

set_parent_bridges(Pid, Bridges)

-spec set_parent_bridges(pid(), [binary()]) -> ok.

Update parent bridge endpoints (for dynamic configuration).

start_link(Config)

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

Start bridge node with registered name.

store_to_parent(Pid, StoreMsg)

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

Store value to parent DHT (for advertisement propagation).

terminate(Reason, State)