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

Method get_proxy_state

gateway/src/debug_service.rs:111–147  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

109 }
110
111 async fn get_proxy_state(self) -> Result<DebugProxyStateResponse> {
112 let state = self.state.lock();
113
114 // Get all instances from ProxyState
115 let instances: Vec<ProxyStateInstance> = state
116 .state
117 .instances
118 .values()
119 .map(|inst| {
120 let reg_time = inst
121 .reg_time
122 .duration_since(std::time::UNIX_EPOCH)
123 .map(|d| d.as_secs())
124 .unwrap_or(0);
125 ProxyStateInstance {
126 instance_id: inst.id.clone(),
127 app_id: inst.app_id.clone(),
128 ip: inst.ip.to_string(),
129 public_key: inst.public_key.clone(),
130 reg_time,
131 }
132 })
133 .collect();
134
135 // Get all allocated addresses
136 let allocated_addresses: Vec<String> = state
137 .state
138 .allocated_addresses
139 .iter()
140 .map(|ip| ip.to_string())
141 .collect();
142
143 Ok(DebugProxyStateResponse {
144 instances,
145 allocated_addresses,
146 })
147 }
148}
149
150impl RpcCall<Proxy> for DebugRpcHandler {

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected