From 4a12293d902c9cf567451cb7c14ff8a6aba73cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20H=C3=A9=20=28S=C4=ABch=C3=A0ng=29?= Date: Sat, 23 Dec 2023 18:50:08 +0800 Subject: [PATCH] correct RIB file name filtering and collector name resolution --- route_verification/rib_stats/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/route_verification/rib_stats/src/main.rs b/route_verification/rib_stats/src/main.rs index 4936839..729947b 100644 --- a/route_verification/rib_stats/src/main.rs +++ b/route_verification/rib_stats/src/main.rs @@ -37,7 +37,12 @@ fn main() { let rib_files = read_dir("../../data/ribs") .unwrap() .map(|maybe_entry| maybe_entry.unwrap().path()) - .filter(|path| path.is_file() && (path.ends_with(".gz") || path.ends_with(".bz2"))) + .filter(|path| { + path.is_file() && { + let extension = path.extension().unwrap(); + extension == "gz" || extension == "bz2" + } + }) .collect::>(); let mut failed = vec![]; @@ -68,7 +73,10 @@ fn main() { } fn process_rib_file(query: &QueryIr, db: &AsRelDb, rib_file: &Path) -> Result<()> { - let rib_file_name = rib_file.to_string_lossy(); + let rib_file_name = rib_file + .file_name() + .expect("RIB file should have a name.") + .to_string_lossy(); let collector = rib_file_name .split("--") .next()