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

Method open

atomic-cli/src/commands/agent/provenance_rpc.rs:90–108  ·  view source on GitHub ↗

Connect to the daemon — starting it when it is down (D4) — and resolve the repository. Returns `None` (never an error) only when the daemon could not be started; the caller then uses the refusal sink, whose operations carry the startup failure into the turn.

(root: &Path)

Source from the content-addressed store, hash-verified

88 /// the daemon could not be started; the caller then uses the refusal
89 /// sink, whose operations carry the startup failure into the turn.
90 pub(crate) fn open(root: &Path) -> Option<Self> {
91 let root = root.to_path_buf();
92 run_outside_async_runtime(move || {
93 let rt = tokio::runtime::Builder::new_current_thread()
94 .enable_all()
95 .build()
96 .context("failed to create provenance rpc runtime")?;
97 rt.block_on(async {
98 let client = AtomicClient::connect_or_start()
99 .await
100 .map_err(|e| anyhow!(e))?;
101 let resolved = resolve_repository(&client, &root).await?;
102 Ok(Self {
103 reference: resolved,
104 })
105 })
106 })
107 .ok()
108 }
109}
110
111/// The journal sink every consumer installs, following the service mode

Callers 1

Calls 5

resolve_repositoryFunction · 0.85
okMethod · 0.45
contextMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected