diff --git a/src/agent/src/image_rpc.rs b/src/agent/src/image_rpc.rs index 818486875b..903107236c 100644 --- a/src/agent/src/image_rpc.rs +++ b/src/agent/src/image_rpc.rs @@ -257,7 +257,7 @@ impl ImageService { } #[async_trait] -impl protocols::image_ttrpc::Image for ImageService { +impl protocols::image_ttrpc_async::Image for ImageService { async fn pull_image( &self, _ctx: &ttrpc::r#async::TtrpcContext, diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index aebdae06a3..d48accd047 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -34,7 +34,10 @@ use protocols::health::{ HealthCheckResponse, HealthCheckResponse_ServingStatus, VersionCheckResponse, }; use protocols::types::Interface; -use protocols::{agent_ttrpc_async as agent_ttrpc, health_ttrpc_async as health_ttrpc}; +use protocols::{ + agent_ttrpc_async as agent_ttrpc, health_ttrpc_async as health_ttrpc, + image_ttrpc_async as image_ttrpc, +}; use rustjail::cgroups::notifier; use rustjail::container::{BaseContainer, Container, LinuxContainer}; use rustjail::process::Process; @@ -1744,27 +1747,26 @@ async fn read_stream(reader: Arc>>, l: usize) -> Resu pub fn start(s: Arc>, server_address: &str) -> Result { let agent_service = Box::new(AgentService { sandbox: s.clone() }) - as Box; - + as Box; let agent_worker = Arc::new(agent_service); let health_service = Box::new(HealthService {}) as Box; let health_worker = Arc::new(health_service); - let image_service = Box::new(image_rpc::ImageService::new(s)) - as Box; + let image_service = + Box::new(image_rpc::ImageService::new(s)) as Box; - let agent_service = protocols::agent_ttrpc::create_agent_service(agent_worker); + let aservice = agent_ttrpc::create_agent_service(agent_worker); - let health_service = protocols::health_ttrpc::create_health(health_worker); + let hservice = health_ttrpc::create_health(health_worker); - let image_service = protocols::image_ttrpc::create_image(Arc::new(image_service)); + let iservice = image_ttrpc::create_image(Arc::new(image_service)); let server = TtrpcServer::new() .bind(server_address)? - .register_service(agent_service) - .register_service(health_service) - .register_service(image_service); + .register_service(aservice) + .register_service(hservice) + .register_service(iservice); info!(sl!(), "ttRPC server started"; "address" => server_address); diff --git a/src/libs/protocols/build.rs b/src/libs/protocols/build.rs index b19dd87008..beba9ee6c7 100644 --- a/src/libs/protocols/build.rs +++ b/src/libs/protocols/build.rs @@ -150,7 +150,6 @@ fn real_main() -> Result<(), std::io::Error> { "protos/oci.proto", "protos/types.proto", "protos/csi.proto", - "protos/image.proto", ], false, )?; @@ -158,13 +157,30 @@ fn real_main() -> Result<(), std::io::Error> { // generate async #[cfg(feature = "async")] { - codegen("src", &["protos/agent.proto", "protos/health.proto"], true)?; + codegen( + "src", + &[ + "protos/agent.proto", + "protos/health.proto", + "protos/image.proto", + ], + true, + )?; fs::rename("src/agent_ttrpc.rs", "src/agent_ttrpc_async.rs")?; fs::rename("src/health_ttrpc.rs", "src/health_ttrpc_async.rs")?; + fs::rename("src/image_ttrpc.rs", "src/image_ttrpc_async.rs")?; } - codegen("src", &["protos/agent.proto", "protos/health.proto"], false)?; + codegen( + "src", + &[ + "protos/agent.proto", + "protos/health.proto", + "protos/image.proto", + ], + false, + )?; // There is a message named 'Box' in oci.proto // so there is a struct named 'Box', we should replace Box to ::std::boxed::Box diff --git a/src/libs/protocols/src/lib.rs b/src/libs/protocols/src/lib.rs index 16afc5b5da..8468784000 100644 --- a/src/libs/protocols/src/lib.rs +++ b/src/libs/protocols/src/lib.rs @@ -13,10 +13,12 @@ pub mod csi; pub mod empty; pub mod health; pub mod health_ttrpc; +#[cfg(feature = "async")] +pub mod health_ttrpc_async; pub mod image; pub mod image_ttrpc; #[cfg(feature = "async")] -pub mod health_ttrpc_async; +pub mod image_ttrpc_async; pub mod oci; pub mod trans; pub mod types;