Module connected_nodes

Module connected_nodes 

Source
Expand description

Query functions for the connected_nodes table.

The connected nodes table maintains a live snapshot of nodes (gateways and hotspots) currently linked to each reflector module. It is updated by Tier 2 XLX monitors as they receive "nodes" push notifications.

Unlike the append-only activity_log, this table uses UPSERT semantics: each node can appear at most once per reflector (enforced by the composite primary key (reflector, node_callsign)). When a monitor receives a fresh node list, it upserts each entry and clears stale nodes that are no longer present.

ยงStaleness eviction

clear_for_reflector deletes all nodes for a given reflector. This is called before upserting the fresh snapshot so that nodes that have disconnected since the last update are removed.

Structsยง

ConnectedNodeRow ๐Ÿ”’
A single row from the connected_nodes table.

Functionsยง

clear_for_reflector ๐Ÿ”’
Deletes all connected node entries for a reflector.
get_for_reflector ๐Ÿ”’
Returns all nodes currently linked to the given reflector.
upsert_node ๐Ÿ”’
Upserts a single connected node entry.