refactor(tvix/store/fuse): use Arc<dyn …> instead of generics

Change-Id: I5685379bd6f89d17da6843d31bef4c1fc4dc0a18
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8745
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-06-11 22:08:54 +03:00 committed by flokli
parent 38a7caaada
commit 09c5ca0a0d
2 changed files with 17 additions and 11 deletions

View file

@ -190,7 +190,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
GRPCPathInfoService::from_client(path_info_service_client.clone()); GRPCPathInfoService::from_client(path_info_service_client.clone());
tokio::task::spawn_blocking(move || { tokio::task::spawn_blocking(move || {
let f = FUSE::new(path_info_service, directory_service, blob_service); let f = FUSE::new(
Arc::new(blob_service),
Arc::new(directory_service),
path_info_service,
);
fuser::mount2(f, &dest, &[]) fuser::mount2(f, &dest, &[])
}) })
.await?? .await??

View file

@ -1,24 +1,26 @@
use crate::{ use crate::{
blobservice::BlobService, directoryservice::DirectoryService, pathinfoservice::PathInfoService, blobservice::BlobService, directoryservice::DirectoryService, pathinfoservice::PathInfoService,
}; };
use std::sync::Arc;
pub struct FUSE<BS: BlobService, DS: DirectoryService, PS: PathInfoService> { pub struct FUSE<PS: PathInfoService> {
blob_service: BS, blob_service: Arc<dyn BlobService>,
directory_service: DS, directory_service: Arc<dyn DirectoryService>,
path_info_service: PS, path_info_service: PS,
} }
impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService> FUSE<BS, DS, PS> { impl<PS: PathInfoService> FUSE<PS> {
pub fn new(path_info_service: PS, directory_service: DS, blob_service: BS) -> Self { pub fn new(
blob_service: Arc<dyn BlobService>,
directory_service: Arc<dyn DirectoryService>,
path_info_service: PS,
) -> Self {
Self { Self {
blob_service, blob_service,
path_info_service,
directory_service, directory_service,
path_info_service,
} }
} }
} }
impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService> fuser::Filesystem impl<PS: PathInfoService> fuser::Filesystem for FUSE<PS> {}
for FUSE<BS, DS, PS>
{
}