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

Function main

atomic-core/examples/semantic_storage.rs:181–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179 Ok(())
180}
181fn main() -> Result<()> {
182 let source = std::env::args()
183 .nth(1)
184 .context("usage: semantic_storage <change-file-or-directory>")?;
185 let mut paths = vec![];
186 collect(Path::new(&source), &mut paths)?;
187 paths.sort();
188 ensure!(!paths.is_empty(), "no change files");
189 let mut totals = Sizes::default();
190 let mut rows = vec![];
191 let mut failures = vec![];
192 for path in paths {
193 match measure(&path).with_context(|| path.display().to_string()) {
194 Ok(row) => {
195 eprintln!(
196 "{}: {} -> {} bytes",
197 path.display(),
198 row.sizes.raw_bytes,
199 row.sizes.selected_bytes
200 );
201 totals.add(&row.sizes);
202 rows.push(row);
203 }
204 Err(error) => {
205 eprintln!("{error:#}");
206 failures.push(format!("{error:#}"));
207 }
208 }
209 }
210 println!(
211 "{}",
212 serde_json::to_string_pretty(&serde_json::json!({"zstd_level":3,
213 "comparison":"new unsigned canonical raw vs adaptive objects; historical files untouched; not a Git-pack comparison",
214 "totals":totals,"rows":rows,"failures":failures}))?
215 );
216 ensure!(
217 failures.is_empty(),
218 "input failures; totals cover only successful inputs"
219 );
220 Ok(())
221}

Callers

nothing calls this directly

Calls 8

sortMethod · 0.80
displayMethod · 0.80
collectFunction · 0.70
measureFunction · 0.70
contextMethod · 0.45
with_contextMethod · 0.45
addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected