about summary refs log tree commit diff
path: root/tvix/store
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-05-22T16·44+0300
committerclbot <clbot@tvl.fyi>2023-05-24T09·01+0000
commit7bd9df01335832705f3ac6d8790e579ecef33d55 (patch)
treeb94a869544e6749533b6cddf3813da7008d06be0 /tvix/store
parent8d392221c67760c7134718e324922b33660609cb (diff)
feat(tvix/store/pathinfosvc): GRPCPathInfoService::from_client r/6188
Change-Id: I4a4f6f713dd76bf95f393c094c0eb9b6d15c5436
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8613
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store')
-rw-r--r--tvix/store/src/pathinfoservice/grpc.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs
index 0e4cbb758c05..6bb774c668a3 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<Channel>].
+    /// panics if called outside the context of a tokio runtime.
+    pub fn from_client(
+        grpc_client: proto::path_info_service_client::PathInfoServiceClient<Channel>,
+    ) -> Self {
+        Self {
+            tokio_handle: tokio::runtime::Handle::current(),
+            grpc_client,
+        }
+    }
 }
 
 impl PathInfoService for GRPCPathInfoService {