This commit is contained in:
sparkzky 2025-02-27 22:34:50 +08:00
parent 377d649d4e
commit a04fd9b185
6 changed files with 13 additions and 17 deletions

2
Cargo.lock generated
View File

@ -1699,8 +1699,8 @@ dependencies = [
"env_logger",
"hex",
"log",
"oci-spec",
"my-workspace-hack",
"oci-spec",
"prost-types",
"serde",
"serde_json",

View File

@ -1,5 +1,5 @@
use crate::types::*;
use actix_web::{web, HttpResponse, Responder};
use actix_web::{HttpResponse, Responder, web};
use service::Service;
use std::sync::Arc;

View File

@ -1,6 +1,6 @@
use std::sync::Arc;
use actix_web::{web, App, HttpServer};
use actix_web::{App, HttpServer, web};
use service::Service;
pub mod handlers;

View File

@ -1,16 +1,17 @@
pub mod spec;
use containerd_client::{
Client,
services::v1::{
container::Runtime,
snapshots::{MountsRequest, PrepareSnapshotRequest},
Container, CreateContainerRequest, CreateTaskRequest, DeleteContainerRequest,
DeleteTaskRequest, GetImageRequest, KillRequest, ListContainersRequest, ListTasksRequest,
ReadContentRequest, StartRequest, WaitRequest,
container::Runtime,
snapshots::{MountsRequest, PrepareSnapshotRequest},
},
tonic::Request,
types::Mount,
with_namespace, Client,
with_namespace,
};
use oci_spec::image::{Arch, ImageConfiguration, ImageIndex, ImageManifest, MediaType, Os};
use prost_types::Any;
@ -63,12 +64,7 @@ impl Service {
Ok(resp)
}
pub async fn create_container(
&self,
image_name: &str,
cid: &str,
ns: &str,
) -> Result<(), Err> {
pub async fn create_container(&self, image_name: &str, cid: &str, ns: &str) -> Result<(), Err> {
let namespace = match ns {
"" => spec::DEFAULT_NAMESPACE,
_ => ns,