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

Function adopt

libatomic/tests/sandbox_service_test.rs:538–570  ·  view source on GitHub ↗

Make the cache at `root` and route its link to the handlers with `opened`'s token.

(
    host: &Host,
    opened: &SandboxOpened,
    root: &Path,
    skeleton: &SandboxSkeleton,
)

Source from the content-addressed store, hash-verified

536/// Make the cache at `root` and route its link to the handlers with
537/// `opened`'s token.
538fn adopt(
539 host: &Host,
540 opened: &SandboxOpened,
541 root: &Path,
542 skeleton: &SandboxSkeleton,
543) -> Repository {
544 let repository = opened.repository.as_ref().unwrap();
545 atomic_repository::write_remote_sandbox_pointer(
546 root,
547 &atomic_repository::RemoteSandboxPointer {
548 repository: atomic_repository::RemoteRepositoryRef {
549 authority: repository.authority.clone(),
550 repository_id: data_encoding::HEXLOWER.encode(&repository.repository_id),
551 },
552 view: opened.view.clone(),
553 view_id: None,
554 token: String::from_utf8(opened.token.clone()).unwrap(),
555 },
556 )
557 .unwrap();
558 routes().lock().unwrap().insert(
559 root.to_path_buf(),
560 Arc::new(Route {
561 state: Arc::clone(&host.state),
562 repository: opened.repository.clone().unwrap(),
563 token: opened.token.clone(),
564 rt: host.rt.handle().clone(),
565 }),
566 );
567 let cache = Repository::create_remote_sandbox_cache(root, skeleton).unwrap();
568 assert!(cache.is_remote_sandbox());
569 cache
570}
571
572// ── the tests ───────────────────────────────────────────────────────────
573

Callers 2

runMethod · 0.85
materializeFunction · 0.85

Calls 8

routesFunction · 0.85
as_refMethod · 0.80
lockMethod · 0.80
unwrapMethod · 0.45
cloneMethod · 0.45
encodeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected