pub struct MeshRegistry { /* private fields */ }Expand description
The registry. Mutex<BTreeMap>, like the peer board: contention is a handful of
datagrams a second, and a deterministic order falls out for free.
Implementations§
Source§impl MeshRegistry
impl MeshRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty registry; it fills only through MeshRegistry::observe.
Sourcepub fn known_key(&self, node: &NodeId) -> Option<String>
pub fn known_key(&self, node: &NodeId) -> Option<String>
The key currently bound to a node id, for trust evaluation.
Sourcepub fn trust_of(&self, node: &NodeId) -> Option<TrustState>
pub fn trust_of(&self, node: &NodeId) -> Option<TrustState>
The current trust state of a node id: the one its runtimes share, the first rejection winning, because trust is a property of the key and not of a server.
Sourcepub fn observe(
&self,
adv: &Advertisement,
node_id: NodeId,
trust: TrustState,
source: MeshSource,
path: &str,
raw: Value,
) -> bool
pub fn observe( &self, adv: &Advertisement, node_id: NodeId, trust: TrustState, source: MeshSource, path: &str, raw: Value, ) -> bool
Record one verified observation; raw is the envelope as heard, kept verbatim
for rendezvous answers. Returns false when the datagram was a replay (same
instance, sequence not above the highest seen) and the record was left unchanged.
Sourcepub fn candidates_for(&self, limit: usize, repos: &[String]) -> Vec<Value>
pub fn candidates_for(&self, limit: usize, repos: &[String]) -> Vec<Value>
The envelopes of present, trusted nodes that serve one of repos, verbatim as heard,
at most limit: what a rendezvous answers a registered caller with. A caller learns
only the nodes of its own repository this node trusts — never the topology of another
repository or the strangers this node merely observed (I2133).
use majordomus_cli::mesh::MeshRegistry;
let empty = MeshRegistry::new();
assert!(empty.candidates_for(32, &["r1".into()]).is_empty());Sourcepub fn list(&self) -> Vec<NodeRecord>
pub fn list(&self) -> Vec<NodeRecord>
Every record, in node-id order, presence recomputed against now.