mirror of
https://github.com/faas-rs/faasd-in-rust.git
synced 2025-06-08 15:56:48 +00:00
fmt
This commit is contained in:
parent
377d649d4e
commit
a04fd9b185
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1699,8 +1699,8 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"hex",
|
"hex",
|
||||||
"log",
|
"log",
|
||||||
"oci-spec",
|
|
||||||
"my-workspace-hack",
|
"my-workspace-hack",
|
||||||
|
"oci-spec",
|
||||||
"prost-types",
|
"prost-types",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use actix_web::{web, HttpResponse, Responder};
|
use actix_web::{HttpResponse, Responder, web};
|
||||||
use service::Service;
|
use service::Service;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@ -36,4 +36,4 @@ pub async fn get_container_list(
|
|||||||
HttpResponse::Ok().json(container_list)
|
HttpResponse::Ok().json(container_list)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加更多的路由处理函数...
|
// 添加更多的路由处理函数...
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{App, HttpServer, web};
|
||||||
use service::Service;
|
use service::Service;
|
||||||
|
|
||||||
pub mod handlers;
|
pub mod handlers;
|
||||||
@ -29,4 +29,4 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.bind("0.0.0.0:18080")?
|
.bind("0.0.0.0:18080")?
|
||||||
.run()
|
.run()
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ pub struct RemoveContainerInfo {
|
|||||||
pub struct GetContainerListQuery {
|
pub struct GetContainerListQuery {
|
||||||
pub status: Option<String>,
|
pub status: Option<String>,
|
||||||
pub ns: String,
|
pub ns: String,
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
pub mod spec;
|
pub mod spec;
|
||||||
|
|
||||||
use containerd_client::{
|
use containerd_client::{
|
||||||
|
Client,
|
||||||
services::v1::{
|
services::v1::{
|
||||||
container::Runtime,
|
|
||||||
snapshots::{MountsRequest, PrepareSnapshotRequest},
|
|
||||||
Container, CreateContainerRequest, CreateTaskRequest, DeleteContainerRequest,
|
Container, CreateContainerRequest, CreateTaskRequest, DeleteContainerRequest,
|
||||||
DeleteTaskRequest, GetImageRequest, KillRequest, ListContainersRequest, ListTasksRequest,
|
DeleteTaskRequest, GetImageRequest, KillRequest, ListContainersRequest, ListTasksRequest,
|
||||||
ReadContentRequest, StartRequest, WaitRequest,
|
ReadContentRequest, StartRequest, WaitRequest,
|
||||||
|
container::Runtime,
|
||||||
|
snapshots::{MountsRequest, PrepareSnapshotRequest},
|
||||||
},
|
},
|
||||||
tonic::Request,
|
tonic::Request,
|
||||||
types::Mount,
|
types::Mount,
|
||||||
with_namespace, Client,
|
with_namespace,
|
||||||
};
|
};
|
||||||
use oci_spec::image::{Arch, ImageConfiguration, ImageIndex, ImageManifest, MediaType, Os};
|
use oci_spec::image::{Arch, ImageConfiguration, ImageIndex, ImageManifest, MediaType, Os};
|
||||||
use prost_types::Any;
|
use prost_types::Any;
|
||||||
@ -63,12 +64,7 @@ impl Service {
|
|||||||
Ok(resp)
|
Ok(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_container(
|
pub async fn create_container(&self, image_name: &str, cid: &str, ns: &str) -> Result<(), Err> {
|
||||||
&self,
|
|
||||||
image_name: &str,
|
|
||||||
cid: &str,
|
|
||||||
ns: &str,
|
|
||||||
) -> Result<(), Err> {
|
|
||||||
let namespace = match ns {
|
let namespace = match ns {
|
||||||
"" => spec::DEFAULT_NAMESPACE,
|
"" => spec::DEFAULT_NAMESPACE,
|
||||||
_ => ns,
|
_ => ns,
|
||||||
@ -524,4 +520,4 @@ impl Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//容器是容器,要先启动,然后才能运行任务
|
//容器是容器,要先启动,然后才能运行任务
|
||||||
//要想删除一个正在运行的Task,必须先kill掉这个task,然后才能删除。
|
//要想删除一个正在运行的Task,必须先kill掉这个task,然后才能删除。
|
||||||
|
@ -315,4 +315,4 @@ pub fn generate_spec(id: &str, ns: &str) -> Result<String, std::io::Error> {
|
|||||||
let path = format!("{}/{}/{}.json", PATH_TO_SPEC_PREFIX, namespace, id);
|
let path = format!("{}/{}/{}.json", PATH_TO_SPEC_PREFIX, namespace, id);
|
||||||
save_spec_to_file(&spec, &path)?;
|
save_spec_to_file(&spec, &path)?;
|
||||||
Ok(path)
|
Ok(path)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user