refactor(tvix/store): remove from_url from PathInfoService trait
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>
This commit is contained in:
parent
abe099b6ba
commit
8111caebc2
4 changed files with 13 additions and 31 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue