diff options
author | Florian Klink <flokli@flokli.de> | 2024-01-04T17·18+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-01-05T16·43+0000 |
commit | f20969de9b42527518b27e3fb78b6d487780baff (patch) | |
tree | 6e3c009731b68f6d8d6ba951017ce68139018f57 /tvix/castore | |
parent | 3297843bf144d2f5abfe44a1858db37720e80054 (diff) |
refactor(tvix/castore): relax trait bounds for DS r/7346
Make this an `AsRef<dyn DirectoryService>`. This helps dropping some Clone requirements. Unfortunately, we can't thread this through to TvixStoreIO just yet. Change-Id: I3f07eb28d6c793d3313fe21506ada84d5a8aa3ac Reviewed-on: https://cl.tvl.fyi/c/depot/+/10533 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/castore')
-rw-r--r-- | tvix/castore/src/import.rs | 4 | ||||
-rw-r--r-- | tvix/castore/src/tests/import.rs | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs index 1b8c4ec5a54e..4545f35fc319 100644 --- a/tvix/castore/src/import.rs +++ b/tvix/castore/src/import.rs @@ -149,7 +149,7 @@ where /// It's up to the caller to possibly register it somewhere (and potentially /// rename it based on some naming scheme) #[instrument(skip(blob_service, directory_service), fields(path=?p), err)] -pub async fn ingest_path<BS, DS, P>( +pub async fn ingest_path<'a, BS, DS, P>( blob_service: BS, directory_service: DS, p: P, @@ -157,7 +157,7 @@ pub async fn ingest_path<BS, DS, P>( where P: AsRef<Path> + Debug, BS: Deref<Target = dyn BlobService> + Clone, - DS: Deref<Target = dyn DirectoryService>, + DS: Deref<Target = &'a dyn DirectoryService>, { let mut directories: HashMap<PathBuf, Directory> = HashMap::default(); diff --git a/tvix/castore/src/tests/import.rs b/tvix/castore/src/tests/import.rs index 75c632799cd9..333254706d61 100644 --- a/tvix/castore/src/tests/import.rs +++ b/tvix/castore/src/tests/import.rs @@ -4,6 +4,7 @@ use crate::fixtures::*; use crate::import::ingest_path; use crate::proto; use crate::utils::{gen_blob_service, gen_directory_service}; +use std::ops::Deref; use std::sync::Arc; use tempfile::TempDir; @@ -27,7 +28,7 @@ async fn symlink() { let root_node = ingest_path( blob_service, - directory_service, + &directory_service.deref(), tmpdir.path().join("doesntmatter"), ) .await @@ -53,7 +54,7 @@ async fn single_file() { let root_node = ingest_path( blob_service.clone(), - directory_service, + &directory_service.deref(), tmpdir.path().join("root"), ) .await @@ -92,7 +93,7 @@ async fn complicated() { let root_node = ingest_path( blob_service.clone(), - directory_service.clone(), + &directory_service.deref(), tmpdir.path(), ) .await |