sbom_tools/diff/
engine_config.rs1use crate::matching::CrossEcosystemConfig;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
7#[allow(dead_code)]
8pub enum AssignmentMethod {
9 #[default]
11 Hungarian,
12 GreedyWithSwaps,
14 Greedy,
16}
17
18#[derive(Debug, Clone)]
20pub struct LargeSbomConfig {
21 pub lsh_threshold: usize,
23 pub cross_ecosystem: CrossEcosystemConfig,
25 pub max_candidates: usize,
27 pub hungarian_threshold: usize,
29 pub enable_swap_optimization: bool,
31 pub max_swap_iterations: usize,
33}
34
35impl Default for LargeSbomConfig {
36 fn default() -> Self {
37 Self {
38 lsh_threshold: 500,
39 cross_ecosystem: CrossEcosystemConfig::default(),
40 max_candidates: 100,
41 hungarian_threshold: 5000,
42 enable_swap_optimization: true,
43 max_swap_iterations: 100,
44 }
45 }
46}
47
48impl LargeSbomConfig {
49 #[must_use]
51 pub const fn enable_cross_ecosystem(&self) -> bool {
52 self.cross_ecosystem.enabled
53 }
54
55 #[must_use]
57 pub fn aggressive() -> Self {
58 Self {
59 lsh_threshold: 300,
60 cross_ecosystem: CrossEcosystemConfig::default(),
61 max_candidates: 50,
62 hungarian_threshold: 3000,
63 enable_swap_optimization: true,
64 max_swap_iterations: 50,
65 }
66 }
67
68 #[must_use]
70 pub fn conservative() -> Self {
71 Self {
72 lsh_threshold: 1000,
73 cross_ecosystem: CrossEcosystemConfig::disabled(),
74 max_candidates: 150,
75 hungarian_threshold: 10000,
76 enable_swap_optimization: true,
77 max_swap_iterations: 200,
78 }
79 }
80}