From a671480b6f0074940a866547345af7396f638d8c Mon Sep 17 00:00:00 2001 From: dolzhuying <1240800466@qq.com> Date: Tue, 15 Apr 2025 10:05:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A7=BB=E9=99=A4app/src=E4=B8=AD=E5=8E=9F?= =?UTF-8?q?=E6=9C=AC=E7=94=A8=E4=BA=8E=E6=B5=8B=E8=AF=95=E7=9A=84=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/app/src/handlers.rs | 39 -------------------------------- crates/app/src/main.rs | 8 ------- crates/app/src/types.rs | 20 ---------------- crates/provider/src/types/mod.rs | 8 ------- 4 files changed, 75 deletions(-) delete mode 100644 crates/app/src/handlers.rs delete mode 100644 crates/app/src/types.rs diff --git a/crates/app/src/handlers.rs b/crates/app/src/handlers.rs deleted file mode 100644 index 14b0631..0000000 --- a/crates/app/src/handlers.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::types::*; -use actix_web::{HttpResponse, Responder, web}; -use service::Service; -use std::sync::Arc; - -/// 创建并启动容器 -pub async fn create_container( - service: web::Data>, - info: web::Json, -) -> impl Responder { - let cid = info.container_id.clone(); - let image = info.image.clone(); - let ns = info.ns.clone(); - service.create_container(&image, &cid, &ns).await.unwrap(); - HttpResponse::Ok().json("Container created successfully!") -} - -/// 删除容器 -pub async fn remove_container( - service: web::Data>, - info: web::Json, -) -> impl Responder { - let container_id = info.container_id.clone(); - let ns = info.ns.clone(); - service.remove_container(&container_id, &ns).await.unwrap(); - HttpResponse::Ok().json("Container removed successfully!") -} - -/// 获取容器列表 -pub async fn get_container_list( - service: web::Data>, - info: web::Json, -) -> impl Responder { - let ns = info.ns.clone(); - let container_list = service.get_container_list(&ns).await.unwrap(); - HttpResponse::Ok().json(container_list) -} - -// 添加更多的路由处理函数... diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index fc089d2..ac8a345 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -2,11 +2,6 @@ use std::sync::Arc; use actix_web::{App, HttpServer, web}; use service::Service; - -pub mod handlers; -pub mod types; - -use handlers::*; use provider::{ handlers::{delete::delete_handler, deploy::deploy_handler, invoke_resolver::InvokeResolver}, proxy::proxy_handler::proxy_handler, @@ -32,9 +27,6 @@ async fn main() -> std::io::Result<()> { .app_data(web::Data::new(service.clone())) .app_data(web::Data::new(resolver.clone())) .app_data(web::Data::new(faas_config.clone())) - .route("/create-container", web::post().to(create_container)) - .route("/remove-container", web::post().to(remove_container)) - .route("/containers", web::get().to(get_container_list)) .route("/system/functions", web::post().to(deploy_handler)) .route("/system/functions", web::delete().to(delete_handler)) .route("/function/{name}{path:/?.*}", web::to(proxy_handler)) diff --git a/crates/app/src/types.rs b/crates/app/src/types.rs deleted file mode 100644 index 9b843e6..0000000 --- a/crates/app/src/types.rs +++ /dev/null @@ -1,20 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize)] -pub struct CreateContainerInfo { - pub container_id: String, - pub image: String, - pub ns: String, -} - -#[derive(Serialize, Deserialize)] -pub struct RemoveContainerInfo { - pub container_id: String, - pub ns: String, -} - -#[derive(Deserialize)] -pub struct GetContainerListQuery { - pub status: Option, - pub ns: String, -} diff --git a/crates/provider/src/types/mod.rs b/crates/provider/src/types/mod.rs index 2057759..0d73aeb 100644 --- a/crates/provider/src/types/mod.rs +++ b/crates/provider/src/types/mod.rs @@ -1,11 +1,3 @@ -use serde::{Deserialize, Serialize}; - pub mod config; pub mod function_deployment; -#[derive(Serialize, Deserialize)] -pub struct CreateContainerInfo { - pub container_id: String, - pub image: String, - pub ns: String, -}