20260415_2 支持多个RIR并行混合执行,APNIC+ARIN运行1 snapshot + 1 delta,对比rpki-client,snapshot比rpki-client慢4分钟(398vs137),输出未收敛,delta时输出收敛(348vs181),评估应该是正确性没有问题,下一步进一步优化性能
This commit is contained in:
@@ -122,6 +122,14 @@ pub fn run_tree_serial_audit(
|
||||
root: CaInstanceHandle,
|
||||
runner: &dyn PublicationPointRunner,
|
||||
config: &TreeRunConfig,
|
||||
) -> Result<TreeRunAuditOutput, TreeRunError> {
|
||||
run_tree_serial_audit_multi_root(vec![root], runner, config)
|
||||
}
|
||||
|
||||
pub fn run_tree_serial_audit_multi_root(
|
||||
roots: Vec<CaInstanceHandle>,
|
||||
runner: &dyn PublicationPointRunner,
|
||||
config: &TreeRunConfig,
|
||||
) -> Result<TreeRunAuditOutput, TreeRunError> {
|
||||
#[derive(Clone, Debug)]
|
||||
struct QueuedCaInstance {
|
||||
@@ -133,13 +141,15 @@ pub fn run_tree_serial_audit(
|
||||
|
||||
let mut next_id: u64 = 0;
|
||||
let mut queue: std::collections::VecDeque<QueuedCaInstance> = std::collections::VecDeque::new();
|
||||
queue.push_back(QueuedCaInstance {
|
||||
id: next_id,
|
||||
handle: root,
|
||||
parent_id: None,
|
||||
discovered_from: None,
|
||||
});
|
||||
next_id += 1;
|
||||
for root in roots {
|
||||
queue.push_back(QueuedCaInstance {
|
||||
id: next_id,
|
||||
handle: root,
|
||||
parent_id: None,
|
||||
discovered_from: None,
|
||||
});
|
||||
next_id += 1;
|
||||
}
|
||||
|
||||
let mut visited_manifest_uris: std::collections::HashSet<String> =
|
||||
std::collections::HashSet::new();
|
||||
@@ -245,6 +255,7 @@ mod tests {
|
||||
use super::{
|
||||
CaInstanceHandle, DiscoveredChildCaInstance, PublicationPointRunResult,
|
||||
PublicationPointRunner, TreeRunConfig, run_tree_serial_audit,
|
||||
run_tree_serial_audit_multi_root,
|
||||
};
|
||||
|
||||
fn sample_handle(manifest: &str) -> CaInstanceHandle {
|
||||
@@ -339,4 +350,23 @@ mod tests {
|
||||
["rsync://example.test/repo/child.mft"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_tree_serial_audit_multi_root_processes_all_roots() {
|
||||
let seen = Arc::new(Mutex::new(Vec::new()));
|
||||
let runner = PrefetchRecordingRunner {
|
||||
seen_prefetch_children: Arc::clone(&seen),
|
||||
};
|
||||
let out = run_tree_serial_audit_multi_root(
|
||||
vec![
|
||||
sample_handle("rsync://example.test/repo/root-a.mft"),
|
||||
sample_handle("rsync://example.test/repo/root-b.mft"),
|
||||
],
|
||||
&runner,
|
||||
&TreeRunConfig::default(),
|
||||
)
|
||||
.expect("tree run");
|
||||
assert_eq!(out.tree.instances_processed, 2);
|
||||
assert_eq!(out.publication_points.len(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user