refactor(tvix/store): remove from_url from PathInfoService trait
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>
This commit is contained in:
parent
abe099b6ba
commit
8111caebc2
4 changed files with 13 additions and 31 deletions
|
|
@ -29,15 +29,12 @@ impl MemoryPathInfoService {
|
|||
directory_service,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl PathInfoService for MemoryPathInfoService {
|
||||
/// Constructs a [MemoryPathInfoService] from the passed [url::Url]:
|
||||
/// - scheme has to be `memory://`
|
||||
/// - there may not be a host.
|
||||
/// - there may not be a path.
|
||||
fn from_url(
|
||||
pub fn from_url(
|
||||
url: &url::Url,
|
||||
blob_service: Arc<dyn BlobService>,
|
||||
directory_service: Arc<dyn DirectoryService>,
|
||||
|
|
@ -52,7 +49,10 @@ impl PathInfoService for MemoryPathInfoService {
|
|||
|
||||
Ok(Self::new(blob_service, directory_service))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl PathInfoService for MemoryPathInfoService {
|
||||
async fn get(&self, digest: [u8; 20]) -> Result<Option<PathInfo>, Error> {
|
||||
let db = self.db.read().unwrap();
|
||||
|
||||
|
|
@ -113,7 +113,6 @@ mod tests {
|
|||
use crate::tests::utils::gen_directory_service;
|
||||
|
||||
use super::MemoryPathInfoService;
|
||||
use super::PathInfoService;
|
||||
|
||||
/// This uses a wrong scheme.
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue