diff options
author | Florian Klink <flokli@flokli.de> | 2023-11-13T09·40+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-11-15T06·43+0000 |
commit | 8111caebc2bb36ebad9c5be9738ad37ca963bd90 (patch) | |
tree | 1ba35408a5cc441d7b1bd155e8ca50d7b74a1404 /tvix/store/src/pathinfoservice/sled.rs | |
parent | abe099b6ba053beaad2c1cb6fc01179578651920 (diff) |
refactor(tvix/store): remove from_url from PathInfoService trait r/7014
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>
Diffstat (limited to 'tvix/store/src/pathinfoservice/sled.rs')
-rw-r--r-- | tvix/store/src/pathinfoservice/sled.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tvix/store/src/pathinfoservice/sled.rs b/tvix/store/src/pathinfoservice/sled.rs index fce0b7f44180..b389b14b95ad 100644 --- a/tvix/store/src/pathinfoservice/sled.rs +++ b/tvix/store/src/pathinfoservice/sled.rs @@ -49,15 +49,12 @@ impl SledPathInfoService { directory_service, }) } -} -#[async_trait] -impl PathInfoService for SledPathInfoService { /// Constructs a [SledPathInfoService] from the passed [url::Url]: /// - scheme has to be `sled://` /// - there may not be a host. /// - a path to the sled needs to be provided (which may not be `/`). - fn from_url( + pub fn from_url( url: &url::Url, blob_service: Arc<dyn BlobService>, directory_service: Arc<dyn DirectoryService>, @@ -86,7 +83,10 @@ impl PathInfoService for SledPathInfoService { .map_err(|e| Error::StorageError(e.to_string())) } } +} +#[async_trait] +impl PathInfoService for SledPathInfoService { async fn get(&self, digest: [u8; 20]) -> Result<Option<PathInfo>, Error> { match self.db.get(digest) { Ok(None) => Ok(None), @@ -180,7 +180,6 @@ mod tests { use crate::tests::utils::gen_blob_service; use crate::tests::utils::gen_directory_service; - use super::PathInfoService; use super::SledPathInfoService; /// This uses a wrong scheme. |