Connect to an already-running daemon. Fails if the socket is absent or not serving.
()
| 96 | /// Connect to an already-running daemon. Fails if the socket is absent |
| 97 | /// or not serving. |
| 98 | pub async fn connect_existing() -> Result<Self, String> { |
| 99 | let socket = socket_path(); |
| 100 | let channel = connect_channel(&socket).await.map_err(|error| { |
| 101 | format!("atomicd is not reachable at {}: {error}", socket.display()) |
| 102 | })?; |
| 103 | let client = Self { channel }; |
| 104 | client |
| 105 | .health() |
| 106 | .await |
| 107 | .map_err(|error| format!("atomicd at {} is not serving: {error}", socket.display()))?; |
| 108 | Ok(client) |
| 109 | } |
| 110 | |
| 111 | /// Connect, starting the daemon when it is down (D4: a local client may |
| 112 | /// start/restart the daemon and retry — never open storage itself). |
nothing calls this directly
no test coverage detected