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

Function persistent_files

libatomic/tests/record_service_test.rs:359–381  ·  view source on GitHub ↗
(root: &std::path::Path)

Source from the content-addressed store, hash-verified

357}
358
359fn persistent_files(root: &std::path::Path) -> std::collections::BTreeMap<String, Vec<u8>> {
360 fn collect(
361 root: &std::path::Path,
362 dir: &std::path::Path,
363 out: &mut std::collections::BTreeMap<String, Vec<u8>>,
364 ) {
365 for entry in std::fs::read_dir(dir).unwrap() {
366 let entry = entry.unwrap();
367 let path = entry.path();
368 if entry.file_type().unwrap().is_dir() {
369 collect(root, &path, out);
370 } else {
371 out.insert(
372 path.strip_prefix(root).unwrap().display().to_string(),
373 std::fs::read(path).unwrap(),
374 );
375 }
376 }
377 }
378 let mut files = std::collections::BTreeMap::new();
379 collect(root, &root.join(".atomic"), &mut files);
380 files
381}
382
383#[tokio::test]
384async fn stale_record_and_insert_refuse_before_capturing_bridge_work() {

Calls 1

collectFunction · 0.70

Tested by

no test coverage detected