Expand description
The one registry of discovered nodes. Every provider’s observation converges here, deduplicated by node id (a digest of the key — never by address), so a node seen over multicast and handed back by a rendezvous is one record with two sources, not two rows with one truth each. Every surface — CLI, HTTP, OpenAPI, MCP, Cockpit — is a projection of this map; nothing else may hold peers.
In memory, bounded, and gone with the process, like the peer board beside it: a discovered node is an observation about now, and persisting it would only let the registry disagree with the network.
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::protocol::advertise;
use majordomus_cli::mesh::registry::{MeshRegistry, MeshSource};
use majordomus_cli::mesh::trust::TrustState;
let registry = MeshRegistry::new();
let node = NodeIdentity::ephemeral().unwrap();
let heard = advertise(&node, 1, &[], &[], &[], "docs");
registry.observe(&heard.adv, node.public.node_id.clone(), TrustState::Observed,
MeshSource::Synthetic, "docs", serde_json::Value::Null);
assert_eq!(registry.list().len(), 1);
assert_eq!(registry.tallies().accepted, 1);Structs§
- Mesh
Registry - The registry.
Mutex<BTreeMap>, like the peer board: contention is a handful of datagrams a second, and a deterministic order falls out for free. - Node
Record - One discovered node: the canonical record every surface projects.
- Sighting
- One provenance entry: a source, and where the observation physically came from.
- Tallies
- The registry’s tallies, for status and health.
Enums§
- Mesh
Source - Where an observation came from. A record accumulates these; provenance is the answer to “why do I see this node”.
- Presence
- Whether the node is answering now, by its own announcements.
Constants§
- MAX_
NODES - The most nodes the registry holds. When full, an insertion evicts the longest-unseen untrusted node; trusted nodes are never evicted for space.
- PRESENCE_
TTL - How long a node stays
presentafter its last advertisement. - RETENTION
- How long an absent node stays listed before it expires out of the registry entirely.