MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / load_routing

Method load_routing

nodedb-cluster/src/catalog/ops.rs:66–81  ·  view source on GitHub ↗

Load the routing table. Returns None if no routing table has been saved.

(&self)

Source from the content-addressed store, hash-verified

64
65 /// Load the routing table. Returns None if no routing table has been saved.
66 pub fn load_routing(&self) -> Result<Option<RoutingTable>> {
67 let txn = self.db.begin_read().map_err(catalog_err)?;
68 let table = txn.open_table(ROUTING_TABLE).map_err(catalog_err)?;
69
70 match table.get(KEY_ROUTING).map_err(catalog_err)? {
71 Some(guard) => {
72 let bytes = guard.value();
73 let rt: RoutingTable =
74 zerompk::from_msgpack(bytes).map_err(|e| ClusterError::Codec {
75 detail: format!("deserialize routing: {e}"),
76 })?;
77 Ok(Some(rt))
78 }
79 None => Ok(None),
80 }
81 }
82}
83
84#[cfg(test)]

Callers 3

restartFunction · 0.80

Calls 1

getMethod · 0.45

Tested by 2