refactor(tvix/store/pathinfosvc): use Arc<dyn …>

This removes the use of generics, like previously done with Blob and
Directory services.

Change-Id: I7cc8bd1439b026c88e80c11e38aafc63c74e5e84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8751
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Florian Klink 2023-06-12 16:04:56 +03:00 committed by flokli
parent 64a4f6185c
commit b5e37869e6
8 changed files with 34 additions and 28 deletions

View file

@ -29,18 +29,18 @@ use crate::{
/// This is to both cover cases of syntactically valid store paths, that exist
/// on the filesystem (still managed by Nix), as well as being able to read
/// files outside store paths.
pub struct TvixStoreIO<PS: PathInfoService> {
pub struct TvixStoreIO {
blob_service: Arc<dyn BlobService>,
directory_service: Arc<dyn DirectoryService>,
path_info_service: PS,
path_info_service: Arc<dyn PathInfoService>,
std_io: StdIO,
}
impl<PS: PathInfoService> TvixStoreIO<PS> {
impl TvixStoreIO {
pub fn new(
blob_service: Arc<dyn BlobService>,
directory_service: Arc<dyn DirectoryService>,
path_info_service: PS,
path_info_service: Arc<dyn PathInfoService>,
) -> Self {
Self {
blob_service,
@ -179,7 +179,7 @@ fn calculate_nar_based_store_path(nar_sha256_digest: &[u8; 32], name: &str) -> S
build_regular_ca_path(name, &nar_hash_with_mode, Vec::<String>::new(), false).unwrap()
}
impl<PS: PathInfoService> EvalIO for TvixStoreIO<PS> {
impl EvalIO for TvixStoreIO {
#[instrument(skip(self), ret, err)]
fn path_exists(&self, path: &Path) -> Result<bool, io::Error> {
if let Ok((store_path, sub_path)) =