refactor: get_running_info fn replace status polling with direct calls (#1441)

This commit is contained in:
Mg Pig
2025-10-04 21:43:34 +08:00
committed by GitHub
parent 5e48626cb9
commit 4d5330fa0a
13 changed files with 181 additions and 118 deletions
+14 -1
View File
@@ -3,7 +3,9 @@ use std::sync::Arc;
use crate::{
instance_manager::NetworkInstanceManager,
proto::{
api::config::{ConfigRpc, PatchConfigRequest, PatchConfigResponse},
api::config::{
ConfigRpc, GetConfigRequest, GetConfigResponse, PatchConfigRequest, PatchConfigResponse,
},
rpc_types::{self, controller::BaseController},
},
};
@@ -33,4 +35,15 @@ impl ConfigRpc for ConfigRpcService {
.patch_config(ctrl, input)
.await
}
async fn get_config(
&self,
ctrl: Self::Controller,
input: GetConfigRequest,
) -> Result<GetConfigResponse, rpc_types::error::Error> {
super::get_instance_service(&self.instance_manager, &input.instance)?
.get_config_service()
.get_config(ctrl, input)
.await
}
}
+2 -1
View File
@@ -76,7 +76,8 @@ impl WebClientService for InstanceManageRpcService {
let mut ret = NetworkInstanceRunningInfoMap {
map: self
.manager
.collect_network_infos()?
.collect_network_infos()
.await?
.into_iter()
.map(|(k, v)| (k.to_string(), v))
.collect(),
+11
View File
@@ -78,6 +78,17 @@ impl PeerManageRpc for PeerManageRpcService {
.await
}
async fn get_foreign_network_summary(
&self,
ctrl: Self::Controller,
req: crate::proto::api::instance::GetForeignNetworkSummaryRequest,
) -> crate::proto::rpc_types::error::Result<instance::GetForeignNetworkSummaryResponse> {
super::get_instance_service(&self.instance_manager, &req.instance)?
.get_peer_manage_service()
.get_foreign_network_summary(ctrl, req)
.await
}
async fn show_node_info(
&self,
ctrl: Self::Controller,