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

Function visit

atomic-cli/tests/it/adaptation_regression_test.rs:276–284  ·  view source on GitHub ↗
(path: &Path, files: &mut BTreeMap<std::path::PathBuf, Vec<u8>>)

Source from the content-addressed store, hash-verified

274 use std::collections::BTreeMap;
275 fn snapshot(root: &Path) -> BTreeMap<std::path::PathBuf, Vec<u8>> {
276 fn visit(path: &Path, files: &mut BTreeMap<std::path::PathBuf, Vec<u8>>) {
277 if path.is_dir() {
278 for entry in fs::read_dir(path).unwrap() {
279 visit(&entry.unwrap().path(), files);
280 }
281 } else if path.is_file() {
282 files.insert(path.to_path_buf(), fs::read(path).unwrap());
283 }
284 }
285 let mut files = BTreeMap::new();
286 for path in ["atomic.redb", "changes", "bridge", "deferred-tree-ops.json"] {
287 visit(&root.join(".atomic").join(path), &mut files);

Callers 1

snapshotFunction · 0.70

Calls 6

is_dirMethod · 0.80
readFunction · 0.70
unwrapMethod · 0.45
pathMethod · 0.45
is_fileMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected