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

Method connect_existing

atomic-client/src/lib.rs:98–109  ·  view source on GitHub ↗

Connect to an already-running daemon. Fails if the socket is absent or not serving.

()

Source from the content-addressed store, hash-verified

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).

Callers

nothing calls this directly

Calls 3

socket_pathFunction · 0.85
connect_channelFunction · 0.85
healthMethod · 0.45

Tested by

no test coverage detected