diff options
author | Florian Klink <flokli@flokli.de> | 2023-11-13T11·48+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-11-15T06·43+0000 |
commit | c83841d3a13a5d5b3fdaa7f9beecd743f1283691 (patch) | |
tree | a7a650962fe78efa9c2c8498301f445dcfe08714 /tvix/castore/src/directoryservice/grpc.rs | |
parent | 840bee1e979518412774ea452c307bfbef0a561e (diff) |
refactor(tvix/castore): remove DirectoryService::from_url r/7021
Make directoryservice::from_addr use the more specific constructors. Change-Id: I9fee2afed77692505988d631d9fe246d9843d25a Reviewed-on: https://cl.tvl.fyi/c/depot/+/10029 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/castore/src/directoryservice/grpc.rs')
-rw-r--r-- | tvix/castore/src/directoryservice/grpc.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/tvix/castore/src/directoryservice/grpc.rs b/tvix/castore/src/directoryservice/grpc.rs index 43d460fae629..f0569ac87800 100644 --- a/tvix/castore/src/directoryservice/grpc.rs +++ b/tvix/castore/src/directoryservice/grpc.rs @@ -35,18 +35,6 @@ impl GRPCDirectoryService { #[async_trait] impl DirectoryService for GRPCDirectoryService { - /// Constructs a [GRPCDirectoryService] 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. - fn from_url(url: &url::Url) -> Result<Self, crate::Error> { - let channel = crate::channel::from_url(url)?; - Ok(Self::from_client( - proto::directory_service_client::DirectoryServiceClient::new(channel), - )) - } - async fn get( &self, digest: &B3Digest, @@ -307,7 +295,7 @@ mod tests { use crate::{ directoryservice::{DirectoryService, GRPCDirectoryService, MemoryDirectoryService}, fixtures::{self, DIRECTORY_A, DIRECTORY_B}, - proto::GRPCDirectoryServiceWrapper, + proto::{directory_service_client::DirectoryServiceClient, GRPCDirectoryServiceWrapper}, utils::gen_directorysvc_grpc_client, }; @@ -476,7 +464,9 @@ mod tests { let grpc_client = { let url = url::Url::parse(&format!("grpc+unix://{}", socket_path.display())) .expect("must parse"); - GRPCDirectoryService::from_url(&url).expect("must succeed") + let client = + DirectoryServiceClient::new(crate::channel::from_url(&url).expect("must succeed")); + GRPCDirectoryService::from_client(client) }; assert!(grpc_client |