diff --git a/shellrt/shellrt-containerd/src/handler/pull.rs b/shellrt/shellrt-containerd/src/handler/pull.rs index f6936cfc4a8..7fe7d833563 100644 --- a/shellrt/shellrt-containerd/src/handler/pull.rs +++ b/shellrt/shellrt-containerd/src/handler/pull.rs @@ -19,7 +19,7 @@ use containerd_grpc::containerd::{ use shellrt_api::v0::{request, response}; use crate::error::*; -use crate::util::TonicRequestExt; +use crate::util::*; pub struct PullHandler { grpc_uri: String, @@ -151,17 +151,10 @@ impl PullHandler { } /// Check if a blob already exists in containerd's content store -async fn already_in_containerd( +async fn already_in_containerd( digest: &Digest, - mut content_client: ContentClient, -) -> Result -where - C: tonic::client::GrpcService, - C::ResponseBody: tonic::codegen::Body + tonic::codegen::HttpBody + Send + 'static, - C::Error: Into, - ::Error: Into + Send, - ::Data: Into + Send, -{ + mut content_client: ContentClient, +) -> Result { let req = tonic::Request::new_namespaced(InfoRequest { digest: digest.to_string(), }); @@ -191,17 +184,10 @@ where /// Check if a blob has been partially downloaded to containerd, returning the /// downloaded offset if applicable. -async fn partially_in_containerd( +async fn partially_in_containerd( digest: &Digest, - mut content_client: ContentClient, -) -> Result> -where - C: tonic::client::GrpcService, - C::ResponseBody: tonic::codegen::Body + tonic::codegen::HttpBody + Send + 'static, - C::Error: Into, - ::Error: Into + Send, - ::Data: Into + Send, -{ + mut content_client: ContentClient, +) -> Result> { let req = tonic::Request::new_namespaced(StatusRequest { r#ref: digest.to_string(), }); @@ -229,19 +215,12 @@ where Ok(offset) } -async fn stream_to_containerd( +async fn stream_to_containerd( blob: Blob, offset: u64, labels: HashMap, - mut content_client: ContentClient, -) -> Result<()> -where - C: tonic::client::GrpcService, - C::ResponseBody: tonic::codegen::Body + tonic::codegen::HttpBody + Send + 'static, - C::Error: Into, - ::Error: Into + Send, - ::Data: Into + Send, -{ + mut content_client: ContentClient, +) -> Result<()> { // why two digests? combinators. let digest = blob.descriptor().digest.clone(); let digest_2 = digest.clone(); @@ -342,18 +321,11 @@ where } } -async fn register_image_with_containerd( +async fn register_image_with_containerd( image: &Reference, manifest_descriptor: &Descriptor, - mut images_client: ImagesClient, -) -> Result<()> -where - C: tonic::client::GrpcService, - C::ResponseBody: tonic::codegen::Body + tonic::codegen::HttpBody + Send + 'static, - C::Error: Into, - ::Error: Into + Send, - ::Data: Into + Send, -{ + mut images_client: ImagesClient, +) -> Result<()> { let now = std::time::SystemTime::now(); let image = || { let manifest_descriptor = manifest_descriptor.clone(); diff --git a/shellrt/shellrt-containerd/src/util.rs b/shellrt/shellrt-containerd/src/util.rs index 35e2167fe61..faf88f29efe 100644 --- a/shellrt/shellrt-containerd/src/util.rs +++ b/shellrt/shellrt-containerd/src/util.rs @@ -17,7 +17,7 @@ impl TonicRequestExt for Request { /// Create a new gRPC request with metadata /// {"containerd-namespace":""} fn new_namespaced(msg: T) -> Request { - let mut req = tonic::Request::new(msg); + let mut req = Request::new(msg); req.metadata_mut() .insert("containerd-namespace", NAMESPACE.clone()); req