about summary refs log tree commit diff
path: root/tvix/store/src/bin
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-11-13T12·32+0200
committerflokli <flokli@flokli.de>2023-11-15T06·43+0000
commit30e0c320666f8ecaf37f6d966e45c40f988cce78 (patch)
tree808bdb2c8832e2083bc17493dc8982b755486824 /tvix/store/src/bin
parentc83841d3a13a5d5b3fdaa7f9beecd743f1283691 (diff)
refactor(tvix/castore/tonic): make async, support wait-connect=? r/7022
This moves the sync `channel::from_url` to a async
`tonic::channel_from_url`. It now allows connecting non-lazily if `wait-
connect=1` is set in the URL params.

Also, make the pingpong tests for blobsvc and directorysvc use the wait-
connect=1 codepath.

Change-Id: Ibeea33117c8121814627e7f6aba0e943ae2e92ca
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10030
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/store/src/bin')
-rw-r--r--tvix/store/src/bin/tvix-store.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs
index 3f7d984cd014..2669073c9140 100644
--- a/tvix/store/src/bin/tvix-store.rs
+++ b/tvix/store/src/bin/tvix-store.rs
@@ -193,13 +193,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             path_info_service_addr,
         } => {
             // initialize stores
-            let blob_service = blobservice::from_addr(&blob_service_addr)?;
-            let directory_service = directoryservice::from_addr(&directory_service_addr)?;
+            let blob_service = blobservice::from_addr(&blob_service_addr).await?;
+            let directory_service = directoryservice::from_addr(&directory_service_addr).await?;
             let path_info_service = pathinfoservice::from_addr(
                 &path_info_service_addr,
                 blob_service.clone(),
                 directory_service.clone(),
-            )?;
+            )
+            .await?;
 
             let listen_address = listen_address
                 .unwrap_or_else(|| "[::]:8000".to_string())
@@ -247,13 +248,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             path_info_service_addr,
         } => {
             // FUTUREWORK: allow flat for single files?
-            let blob_service = blobservice::from_addr(&blob_service_addr)?;
-            let directory_service = directoryservice::from_addr(&directory_service_addr)?;
+            let blob_service = blobservice::from_addr(&blob_service_addr).await?;
+            let directory_service = directoryservice::from_addr(&directory_service_addr).await?;
             let path_info_service = pathinfoservice::from_addr(
                 &path_info_service_addr,
                 blob_service.clone(),
                 directory_service.clone(),
-            )?;
+            )
+            .await?;
 
             let tasks = paths
                 .into_iter()
@@ -343,13 +345,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             list_root,
             threads,
         } => {
-            let blob_service = blobservice::from_addr(&blob_service_addr)?;
-            let directory_service = directoryservice::from_addr(&directory_service_addr)?;
+            let blob_service = blobservice::from_addr(&blob_service_addr).await?;
+            let directory_service = directoryservice::from_addr(&directory_service_addr).await?;
             let path_info_service = pathinfoservice::from_addr(
                 &path_info_service_addr,
                 blob_service.clone(),
                 directory_service.clone(),
-            )?;
+            )
+            .await?;
 
             let mut fuse_daemon = tokio::task::spawn_blocking(move || {
                 let f = TvixStoreFs::new(
@@ -383,13 +386,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
             path_info_service_addr,
             list_root,
         } => {
-            let blob_service = blobservice::from_addr(&blob_service_addr)?;
-            let directory_service = directoryservice::from_addr(&directory_service_addr)?;
+            let blob_service = blobservice::from_addr(&blob_service_addr).await?;
+            let directory_service = directoryservice::from_addr(&directory_service_addr).await?;
             let path_info_service = pathinfoservice::from_addr(
                 &path_info_service_addr,
                 blob_service.clone(),
                 directory_service.clone(),
-            )?;
+            )
+            .await?;
 
             tokio::task::spawn_blocking(move || {
                 let fs = TvixStoreFs::new(