MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / compare_table

Function compare_table

atomic-repository/src/repository/repair.rs:1726–1778  ·  view source on GitHub ↗
(
    index: NativeIndex,
    expected: BTreeMap<String, String>,
    actual: Result<BTreeMap<String, String>, PristineError>,
    report: &mut NativeIndexReport,
)

Source from the content-addressed store, hash-verified

1724}
1725
1726fn compare_table(
1727 index: NativeIndex,
1728 expected: BTreeMap<String, String>,
1729 actual: Result<BTreeMap<String, String>, PristineError>,
1730 report: &mut NativeIndexReport,
1731) {
1732 let actual = match actual {
1733 Ok(actual) => actual,
1734 Err(error) => {
1735 report.problems.push(NativeIndexProblem {
1736 index,
1737 kind: NativeIndexProblemKind::Malformed,
1738 key: "<table>".to_string(),
1739 expected: None,
1740 actual: Some(error.to_string()),
1741 });
1742 return;
1743 }
1744 };
1745 report.actual_rows += actual.len();
1746 for (key, expected_value) in &expected {
1747 match actual.get(key) {
1748 None => report.problems.push(NativeIndexProblem {
1749 index,
1750 kind: NativeIndexProblemKind::Missing,
1751 key: key.clone(),
1752 expected: Some(expected_value.clone()),
1753 actual: None,
1754 }),
1755 Some(actual_value) if actual_value != expected_value => {
1756 report.problems.push(NativeIndexProblem {
1757 index,
1758 kind: NativeIndexProblemKind::Mismatched,
1759 key: key.clone(),
1760 expected: Some(expected_value.clone()),
1761 actual: Some(actual_value.clone()),
1762 });
1763 }
1764 Some(_) => {}
1765 }
1766 }
1767 for (key, actual_value) in actual {
1768 if !expected.contains_key(&key) {
1769 report.problems.push(NativeIndexProblem {
1770 index,
1771 kind: NativeIndexProblemKind::Stale,
1772 key,
1773 expected: None,
1774 actual: Some(actual_value),
1775 });
1776 }
1777 }
1778}
1779
1780fn canonical_path_claims(rows: &[PathClaimEntry]) -> BTreeMap<String, String> {
1781 rows.iter()

Callers 1

Calls 5

contains_keyMethod · 0.80
getMethod · 0.65
pushMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected