diff --git a/veilid-core/src/routing_table/mod.rs b/veilid-core/src/routing_table/mod.rs index 3665c3c9..1d63fcb5 100644 --- a/veilid-core/src/routing_table/mod.rs +++ b/veilid-core/src/routing_table/mod.rs @@ -57,6 +57,8 @@ pub struct LowLevelPortInfo { } pub type RoutingTableEntryFilter<'t> = Box>) -> bool + Send + 't>; +pub type SerializedBuckets = Vec>; +pub type SerializedBucketMap = BTreeMap; #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct RoutingTableHealth { @@ -293,13 +295,13 @@ impl RoutingTable { } /// Serialize the routing table. - fn serialized_buckets(&self) -> EyreResult<(BTreeMap>>, Vec>)> { + fn serialized_buckets(&self) -> EyreResult<(SerializedBucketMap, SerializedBuckets)> { // Since entries are shared by multiple buckets per cryptokind // we need to get the list of all unique entries when serializing let mut all_entries: Vec> = Vec::new(); // Serialize all buckets and get map of entries - let mut serialized_bucket_map: BTreeMap>> = BTreeMap::new(); + let mut serialized_bucket_map: SerializedBucketMap = BTreeMap::new(); { let mut entry_map: HashMap<*const BucketEntry, u32> = HashMap::new(); let inner = &*self.inner.read(); @@ -347,11 +349,11 @@ impl RoutingTable { // Deserialize bucket map and all entries from the table store let tstore = self.unlocked_inner.network_manager().table_store(); let tdb = tstore.open("routing_table", 1).await?; - let Some(serialized_bucket_map): Option>>> = tdb.load_rkyv(0, b"serialized_bucket_map").await? else { + let Some(serialized_bucket_map): Option = tdb.load_rkyv(0, b"serialized_bucket_map").await? else { log_rtab!(debug "no bucket map in saved routing table"); return Ok(()); }; - let Some(all_entry_bytes): Option>> = tdb.load_rkyv(0, b"all_entry_bytes").await? else { + let Some(all_entry_bytes): Option = tdb.load_rkyv(0, b"all_entry_bytes").await? else { log_rtab!(debug "no all_entry_bytes in saved routing table"); return Ok(()); }; @@ -367,8 +369,8 @@ impl RoutingTable { pub fn populate_routing_table( &self, inner: &mut RoutingTableInner, - serialized_bucket_map: BTreeMap>>, - all_entry_bytes: Vec>, + serialized_bucket_map: SerializedBucketMap, + all_entry_bytes: SerializedBuckets, ) -> EyreResult<()> { let mut all_entries: Vec> = Vec::with_capacity(all_entry_bytes.len()); for entry_bytes in all_entry_bytes {