refactor(tvix/store/blobsvc): make from_addr not async

A previous iteration of this code did actually connect (in the gRPC
client), which was why we had this function async.

However, as the connection there is now lazy too, we can drop the
asyncness in this function.

Change-Id: Idd5bd953a6a1c2334066ee672cfb87fcb74f9f94
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8780
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Florian Klink 2023-06-15 00:00:39 +03:00 committed by clbot
parent 35bff2bda6
commit c5851fb815
2 changed files with 4 additions and 4 deletions

View file

@ -128,7 +128,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
path_info_service_addr,
} => {
// initialize stores
let blob_service = blobservice::from_addr(&blob_service_addr).await?;
let blob_service = blobservice::from_addr(&blob_service_addr)?;
let directory_service = directoryservice::from_addr(&directory_service_addr)?;
let path_info_service = pathinfoservice::from_addr(
&path_info_service_addr,
@ -173,7 +173,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
directory_service_addr,
path_info_service_addr,
} => {
let blob_service = blobservice::from_addr(&blob_service_addr).await?;
let blob_service = blobservice::from_addr(&blob_service_addr)?;
let directory_service = directoryservice::from_addr(&directory_service_addr)?;
let path_info_service = pathinfoservice::from_addr(
&path_info_service_addr,
@ -211,7 +211,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
directory_service_addr,
path_info_service_addr,
} => {
let blob_service = blobservice::from_addr(&blob_service_addr).await?;
let blob_service = blobservice::from_addr(&blob_service_addr)?;
let directory_service = directoryservice::from_addr(&directory_service_addr)?;
let path_info_service = pathinfoservice::from_addr(
&path_info_service_addr,

View file

@ -11,7 +11,7 @@ use super::{BlobService, GRPCBlobService, MemoryBlobService, SledBlobService};
/// - `grpc+*://` ([GRPCBlobService])
///
/// See their [from_url] methods for more details about their syntax.
pub async fn from_addr(uri: &str) -> Result<Arc<dyn BlobService>, crate::Error> {
pub fn from_addr(uri: &str) -> Result<Arc<dyn BlobService>, crate::Error> {
let url = Url::parse(uri).map_err(|e| {
crate::Error::StorageError(format!("unable to parse url: {}", e.to_string()))
})?;