From 1b62f82b10d82f1fb503daf52184ce5f72d0288f Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 1 Jan 2024 03:23:23 +0200 Subject: refactor(tvix/castore/blobsvc/grpc/wrapper): don't require Arc<_> Change-Id: I9655f5588c7dc98427de6af47d74b4ab7ce22071 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10516 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: raitobezarius --- tvix/castore/src/proto/grpc_blobservice_wrapper.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tvix/castore/src/proto/grpc_blobservice_wrapper.rs') diff --git a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs index a37cc299b8a3..063f0421ddee 100644 --- a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs +++ b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs @@ -6,22 +6,19 @@ use std::{ io, ops::{Deref, DerefMut}, pin::Pin, - sync::Arc, }; use tokio_stream::StreamExt; use tokio_util::io::ReaderStream; use tonic::{async_trait, Request, Response, Status, Streaming}; use tracing::{instrument, warn}; -pub struct GRPCBlobServiceWrapper { - blob_service: Arc, +pub struct GRPCBlobServiceWrapper { + blob_service: T, } -impl From> for GRPCBlobServiceWrapper { - fn from(value: Arc) -> Self { - Self { - blob_service: value, - } +impl GRPCBlobServiceWrapper { + pub fn new(blob_service: T) -> Self { + Self { blob_service } } } @@ -84,7 +81,10 @@ unsafe impl bytes::BufMut for BytesMutWithDefaultCapacity { } #[async_trait] -impl super::blob_service_server::BlobService for GRPCBlobServiceWrapper { +impl super::blob_service_server::BlobService for GRPCBlobServiceWrapper +where + T: Deref + Send + Sync + 'static, +{ // https://github.com/tokio-rs/tokio/issues/2723#issuecomment-1534723933 type ReadStream = Pin> + Send + 'static>>; -- cgit 1.4.1