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

Function routing_save_load_roundtrip

nodedb-cluster/src/catalog/ops.rs:127–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125
126 #[test]
127 fn routing_save_load_roundtrip() {
128 let (_dir, catalog) = temp_catalog();
129
130 // uniform(4, ...) creates 4 data groups + 1 metadata group = 5 total.
131 let rt = RoutingTable::uniform(4, &[1, 2, 3], 3);
132 catalog.save_routing(&rt).unwrap();
133 let loaded = catalog.load_routing().unwrap().unwrap();
134
135 assert_eq!(loaded.num_groups(), 5);
136 assert_eq!(loaded.vshard_to_group().len(), 1024);
137 for i in 0..1024u32 {
138 assert_eq!(
139 rt.group_for_vshard(i).unwrap(),
140 loaded.group_for_vshard(i).unwrap()
141 );
142 }
143 }
144
145 #[test]
146 fn empty_catalog_returns_none() {

Callers

nothing calls this directly

Calls 3

save_routingMethod · 0.80
load_routingMethod · 0.80
temp_catalogFunction · 0.70

Tested by

no test coverage detected