Manually implement absorb_second in RouterInner

This allows us to avoid a clone on the routelist Arc.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet committed 2024-07-17 09:58:18 +02:00
1 parent e6c5990b89
commit e5ce09545b
1 file changed
+16
+16
View File
@@ -637,6 +637,22 @@ impl left_right::Absorb<RoutingTableOplogEntry> for RoutingTableInner {
self.table.insert(k, ss, v.clone());
}
}
fn absorb_second(&mut self, operation: RoutingTableOplogEntry, _: &Self) {
match operation {
RoutingTableOplogEntry::Upsert(subnet, list) => {
self.table.insert(
expect_ipv6(subnet.address()),
subnet.prefix_len().into(),
list,
);
}
RoutingTableOplogEntry::Delete(subnet) => {
self.table
.remove(expect_ipv6(subnet.address()), subnet.prefix_len().into());
}
}
}
}
impl Drop for RoutingTable {