From 8d392221c67760c7134718e324922b33660609cb Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 22 May 2023 19:43:29 +0300 Subject: feat(tvix/store/directorysvc): GRPCDirectoryService::from_client Change-Id: Ifa274a380683b01f0f24cd9ff1f50d22f13b38bd Reviewed-on: https://cl.tvl.fyi/c/depot/+/8612 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: flokli --- tvix/store/src/directoryservice/grpc.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tvix/store/src/directoryservice/grpc.rs b/tvix/store/src/directoryservice/grpc.rs index 46e19224c7..1b33572cf7 100644 --- a/tvix/store/src/directoryservice/grpc.rs +++ b/tvix/store/src/directoryservice/grpc.rs @@ -32,6 +32,17 @@ impl GRPCDirectoryService { grpc_client, } } + + /// construct a [GRPCDirectoryService] from a [proto::blob_service_client::BlobServiceClient]. + /// panics if called outside the context of a tokio runtime. + pub fn from_client( + grpc_client: proto::directory_service_client::DirectoryServiceClient, + ) -> Self { + Self { + tokio_handle: tokio::runtime::Handle::current(), + grpc_client, + } + } } impl DirectoryService for GRPCDirectoryService { -- cgit 1.4.1