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

Function binding_census_class

atomic-cli/src/commands/git/census.rs:94–142  ·  view source on GitHub ↗

Every stored binding loads and passes its cryptographic verification (payload validity + signature).

(repo: &Repository)

Source from the content-addressed store, hash-verified

92/// Every stored binding loads and passes its cryptographic verification
93/// (payload validity + signature).
94fn binding_census_class(repo: &Repository) -> CensusClass {
95 let name = "census/bindings";
96 match repo.binding_ids() {
97 Ok(ids) => {
98 let total = ids.len();
99 let mut invalid: Vec<String> = Vec::new();
100 let mut unloaded: Vec<String> = Vec::new();
101 for id in &ids {
102 match repo.load_binding(id) {
103 Ok(Some(binding)) => {
104 if verify_binding_cryptography(&binding).is_err() {
105 invalid.push(binding_id_hex(id));
106 }
107 }
108 Ok(None) => unloaded.push(binding_id_hex(id)),
109 Err(error) => unloaded.push(format!(
110 "{} ({})",
111 binding_id_hex(id),
112 repository_error(error)
113 )),
114 }
115 }
116 if invalid.is_empty() && unloaded.is_empty() {
117 CensusClass {
118 name,
119 clean: true,
120 detail: format!("{total} stored binding(s) verify"),
121 }
122 } else {
123 CensusClass {
124 name,
125 clean: false,
126 detail: format!(
127 "{} invalid binding(s) [{}], {} unloadable [{}]",
128 invalid.len(),
129 invalid.join(", "),
130 unloaded.len(),
131 unloaded.join(", ")
132 ),
133 }
134 }
135 }
136 Err(error) => CensusClass {
137 name,
138 clean: false,
139 detail: format!("cannot enumerate bindings: {error}"),
140 },
141 }
142}
143
144/// Every working-copy record names an existing view; the CURRENT working
145/// copy's staleness is the durable layer's verdict, and other working

Callers

nothing calls this directly

Calls 7

binding_idsMethod · 0.80
load_bindingMethod · 0.80
binding_id_hexFunction · 0.70
lenMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected