20260415_2 支持多个RIR并行混合执行,APNIC+ARIN运行1 snapshot + 1 delta,对比rpki-client,snapshot比rpki-client慢4分钟(398vs137),输出未收敛,delta时输出收敛(348vs181),评估应该是正确性没有问题,下一步进一步优化性能

This commit is contained in:
2026-04-16 11:33:52 +08:00
parent 585c41b83b
commit 38421b1ae7
5 changed files with 594 additions and 82 deletions

View File

@@ -6,8 +6,13 @@ use crate::report::Warning;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TalSource {
Url(String),
DerBytes { tal_url: String, ta_der: Vec<u8> },
DerBytes {
tal_url: String,
tal_bytes: Vec<u8>,
ta_der: Vec<u8>,
},
FilePath(PathBuf),
FilePathWithTa { tal_path: PathBuf, ta_path: PathBuf },
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -38,13 +43,35 @@ impl TalInputSpec {
}
}
pub fn from_ta_der(tal_url: impl Into<String>, ta_der: Vec<u8>) -> Self {
pub fn from_file_path_with_ta(
tal_path: impl Into<PathBuf>,
ta_path: impl Into<PathBuf>,
) -> Self {
let tal_path = tal_path.into();
let ta_path = ta_path.into();
let tal_id = derive_tal_id_from_path(&tal_path);
Self {
rir_id: tal_id.clone(),
tal_id,
source: TalSource::FilePathWithTa { tal_path, ta_path },
}
}
pub fn from_ta_der(
tal_url: impl Into<String>,
tal_bytes: Vec<u8>,
ta_der: Vec<u8>,
) -> Self {
let tal_url = tal_url.into();
let tal_id = derive_tal_id_from_url_like(&tal_url);
Self {
rir_id: tal_id.clone(),
tal_id,
source: TalSource::DerBytes { tal_url, ta_der },
source: TalSource::DerBytes {
tal_url,
tal_bytes,
ta_der,
},
}
}
}
@@ -316,13 +343,18 @@ mod tests {
#[test]
fn tal_input_spec_from_ta_der_preserves_payload() {
let spec = TalInputSpec::from_ta_der("https://example.test/ripe.tal", vec![1, 2, 3]);
let spec = TalInputSpec::from_ta_der(
"https://example.test/ripe.tal",
vec![4, 5, 6],
vec![1, 2, 3],
);
assert_eq!(spec.tal_id, "ripe");
assert_eq!(spec.rir_id, "ripe");
assert_eq!(
spec.source,
TalSource::DerBytes {
tal_url: "https://example.test/ripe.tal".to_string(),
tal_bytes: vec![4, 5, 6],
ta_der: vec![1, 2, 3],
}
);