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

Function materialize

libatomic/tests/sandbox_service_test.rs:450–463  ·  view source on GitHub ↗

Materialize `opened`'s view into a fresh directory, as a sandbox does: every entry through the kernel's path-checked writer, then the cache.

(host: &Host, opened: &SandboxOpened)

Source from the content-addressed store, hash-verified

448/// Materialize `opened`'s view into a fresh directory, as a sandbox does:
449/// every entry through the kernel's path-checked writer, then the cache.
450fn materialize(host: &Host, opened: &SandboxOpened) -> Vm {
451 let dir = TempDir::new().unwrap();
452 let root = dir.path().join("work");
453 std::fs::create_dir_all(&root).unwrap();
454 let root = root.canonicalize().unwrap();
455 let (entries, skeleton) = materialize_into(host, &opened.token, &root);
456 let cache = adopt(host, opened, &root, &skeleton);
457 Vm {
458 _dir: dir,
459 root,
460 cache,
461 entries,
462 }
463}
464
465fn materialize_into(host: &Host, token: &[u8], root: &Path) -> (u64, SandboxSkeleton) {
466 materialize_prefix_into(host, token, root, None)

Calls 5

materialize_intoFunction · 0.85
adoptFunction · 0.85
canonicalizeMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected