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

Method status

gateway/src/admin_service.rs:42–78  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40
41impl AdminRpcHandler {
42 pub(crate) async fn status(self) -> Result<StatusResponse> {
43 let (base_domain, _port) = self
44 .state
45 .kv_store()
46 .get_best_zt_domain()
47 .unwrap_or_default();
48 let mut state = self.state.lock();
49 state.refresh_state()?;
50 let hosts = state
51 .state
52 .instances
53 .values()
54 .map(|instance| {
55 // Get global latest_handshake from KvStore (max across all nodes)
56 let latest_handshake = state
57 .get_instance_latest_handshake(&instance.id)
58 .unwrap_or(0);
59 HostInfo {
60 instance_id: instance.id.clone(),
61 ip: instance.ip.to_string(),
62 app_id: instance.app_id.clone(),
63 base_domain: base_domain.clone(),
64 latest_handshake,
65 num_connections: instance.num_connections(),
66 }
67 })
68 .collect::<Vec<_>>();
69 Ok(StatusResponse {
70 id: state.config.sync.node_id,
71 url: state.config.sync.my_url.clone(),
72 uuid: state.config.uuid(),
73 bootnode_url: state.config.sync.bootnode.clone(),
74 nodes: state.get_all_nodes(),
75 hosts,
76 num_connections: NUM_CONNECTIONS.load(Ordering::Relaxed),
77 })
78 }
79}
80
81impl AdminRpc for AdminRpcHandler {

Callers 15

send_requestFunction · 0.45
verify_quoted_keyMethod · 0.45
refresh_known_keysMethod · 0.45
http_requestFunction · 0.45
mount_e2fsMethod · 0.45
runMethod · 0.45
requestMethod · 0.45
resolve_zone_idMethod · 0.45
add_recordMethod · 0.45
remove_record_innerMethod · 0.45
get_records_innerMethod · 0.45

Calls 10

get_best_zt_domainMethod · 0.80
kv_storeMethod · 0.80
refresh_stateMethod · 0.80
cloneMethod · 0.80
num_connectionsMethod · 0.80
get_all_nodesMethod · 0.80
lockMethod · 0.45
uuidMethod · 0.45
loadMethod · 0.45

Tested by 1

get_test_image_dirFunction · 0.36