MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / get_info

Method get_info

gateway/src/admin_service.rs:106–140  ·  view source on GitHub ↗
(self, request: GetInfoRequest)

Source from the content-addressed store, hash-verified

104 }
105
106 async fn get_info(self, request: GetInfoRequest) -> Result<GetInfoResponse> {
107 let (base_domain, _port) = self
108 .state
109 .kv_store()
110 .get_best_zt_domain()
111 .unwrap_or_default();
112 let state = self.state.lock();
113 let handshakes = state.latest_handshakes(None)?;
114
115 if let Some(instance) = state.state.instances.get(&request.id) {
116 let host_info = HostInfo {
117 instance_id: instance.id.clone(),
118 ip: instance.ip.to_string(),
119 app_id: instance.app_id.clone(),
120 base_domain,
121 latest_handshake: {
122 let (ts, _) = handshakes
123 .get(&instance.public_key)
124 .copied()
125 .unwrap_or_default();
126 ts
127 },
128 num_connections: instance.num_connections(),
129 };
130 Ok(GetInfoResponse {
131 found: true,
132 info: Some(host_info),
133 })
134 } else {
135 Ok(GetInfoResponse {
136 found: false,
137 info: None,
138 })
139 }
140 }
141
142 async fn get_meta(self) -> Result<GetMetaResponse> {
143 let state = self.state.lock();

Callers

nothing calls this directly

Calls 7

get_best_zt_domainMethod · 0.80
kv_storeMethod · 0.80
latest_handshakesMethod · 0.80
cloneMethod · 0.80
num_connectionsMethod · 0.80
lockMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected