about summary refs log tree commit diff
path: root/tvix/store/src/pathinfoservice/grpc.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-11-13T09·40+0200
committerflokli <flokli@flokli.de>2023-11-15T06·43+0000
commit8111caebc2bb36ebad9c5be9738ad37ca963bd90 (patch)
tree1ba35408a5cc441d7b1bd155e8ca50d7b74a1404 /tvix/store/src/pathinfoservice/grpc.rs
parentabe099b6ba053beaad2c1cb6fc01179578651920 (diff)
refactor(tvix/store): remove from_url from PathInfoService trait r/7014
We don't gain much from making this part of the trait, it's still up to
`tvix_store::pathinfoservice::from_addr` to do most of the construction.

Move it out of the trait and into the specific *Service impls directly.

This allows further refactorings in followup CLs.

Change-Id: I99b93ef4acd83637a2f4888a1e586f1ca96390dc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10022
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/store/src/pathinfoservice/grpc.rs')
-rw-r--r--tvix/store/src/pathinfoservice/grpc.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs
index 5363109efc28..7428830abd10 100644
--- a/tvix/store/src/pathinfoservice/grpc.rs
+++ b/tvix/store/src/pathinfoservice/grpc.rs
@@ -24,17 +24,14 @@ impl GRPCPathInfoService {
     ) -> Self {
         Self { grpc_client }
     }
-}
 
-#[async_trait]
-impl PathInfoService for GRPCPathInfoService {
     /// Constructs a [GRPCPathInfoService] from the passed [url::Url]:
     /// - scheme has to match `grpc+*://`.
     ///   That's normally grpc+unix for unix sockets, and grpc+http(s) for the HTTP counterparts.
     /// - In the case of unix sockets, there must be a path, but may not be a host.
     /// - In the case of non-unix sockets, there must be a host, but no path.
     /// The blob_service and directory_service arguments are ignored, because the gRPC service already provides answers to these questions.
-    fn from_url(
+    pub fn from_url(
         url: &url::Url,
         _blob_service: Arc<dyn BlobService>,
         _directory_service: Arc<dyn DirectoryService>,
@@ -44,7 +41,10 @@ impl PathInfoService for GRPCPathInfoService {
             proto::path_info_service_client::PathInfoServiceClient::new(channel),
         ))
     }
+}
 
+#[async_trait]
+impl PathInfoService for GRPCPathInfoService {
     async fn get(&self, digest: [u8; 20]) -> Result<Option<PathInfo>, Error> {
         let path_info = self
             .grpc_client