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)
| 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 |
no test coverage detected