chore(tvix/store/directorysvc): remove GRPCDirectoryService::new

The only place where we did use new was also already where we've been in
a tokio context, so just using from_client is easier.

Change-Id: I39dbc18f6aaa3abc342409be623395647f968530
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8754
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Florian Klink 2023-06-12 23:49:22 +03:00 committed by clbot
parent 37e7742ba9
commit 011fbe2214

View file

@ -21,18 +21,6 @@ pub struct GRPCDirectoryService {
} }
impl GRPCDirectoryService { impl GRPCDirectoryService {
/// Construct a new [GRPCDirectoryService], by passing a handle to the
/// tokio runtime, and a gRPC client.
pub fn new(
tokio_handle: tokio::runtime::Handle,
grpc_client: proto::directory_service_client::DirectoryServiceClient<Channel>,
) -> Self {
Self {
tokio_handle,
grpc_client,
}
}
/// construct a [GRPCDirectoryService] from a [proto::blob_service_client::BlobServiceClient<Channel>]. /// construct a [GRPCDirectoryService] from a [proto::blob_service_client::BlobServiceClient<Channel>].
/// panics if called outside the context of a tokio runtime. /// panics if called outside the context of a tokio runtime.
pub fn from_client( pub fn from_client(
@ -413,8 +401,7 @@ mod tests {
let grpc_client = proto::directory_service_client::DirectoryServiceClient::new(channel); let grpc_client = proto::directory_service_client::DirectoryServiceClient::new(channel);
// create the GrpcDirectoryService, using the tester_runtime. // create the GrpcDirectoryService, using the tester_runtime.
let directory_service = let directory_service = super::GRPCDirectoryService::from_client(grpc_client);
super::GRPCDirectoryService::new(tokio::runtime::Handle::current(), grpc_client);
// try to get DIRECTORY_A should return Ok(None) // try to get DIRECTORY_A should return Ok(None)
assert_eq!( assert_eq!(