From 7bd9df01335832705f3ac6d8790e579ecef33d55 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 22 May 2023 19:44:49 +0300 Subject: feat(tvix/store/pathinfosvc): GRPCPathInfoService::from_client Change-Id: I4a4f6f713dd76bf95f393c094c0eb9b6d15c5436 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8613 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: flokli --- tvix/store/src/pathinfoservice/grpc.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tvix/store') diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs index 0e4cbb758c..6bb774c668 100644 --- a/tvix/store/src/pathinfoservice/grpc.rs +++ b/tvix/store/src/pathinfoservice/grpc.rs @@ -25,6 +25,17 @@ impl GRPCPathInfoService { grpc_client, } } + + /// construct a [GRPCDirectoryService] from a [proto::path_info_service_client::PathInfoServiceClient]. + /// panics if called outside the context of a tokio runtime. + pub fn from_client( + grpc_client: proto::path_info_service_client::PathInfoServiceClient, + ) -> Self { + Self { + tokio_handle: tokio::runtime::Handle::current(), + grpc_client, + } + } } impl PathInfoService for GRPCPathInfoService { -- cgit 1.4.1