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:
parent
38a7caaada
commit
09c5ca0a0d
2 changed files with 17 additions and 11 deletions
|
@ -190,7 +190,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
GRPCPathInfoService::from_client(path_info_service_client.clone());
|
||||
|
||||
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, &[])
|
||||
})
|
||||
.await??
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
use crate::{
|
||||
blobservice::BlobService, directoryservice::DirectoryService, pathinfoservice::PathInfoService,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct FUSE<BS: BlobService, DS: DirectoryService, PS: PathInfoService> {
|
||||
blob_service: BS,
|
||||
directory_service: DS,
|
||||
pub struct FUSE<PS: PathInfoService> {
|
||||
blob_service: Arc<dyn BlobService>,
|
||||
directory_service: Arc<dyn DirectoryService>,
|
||||
path_info_service: PS,
|
||||
}
|
||||
|
||||
impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService> FUSE<BS, DS, PS> {
|
||||
pub fn new(path_info_service: PS, directory_service: DS, blob_service: BS) -> Self {
|
||||
impl<PS: PathInfoService> FUSE<PS> {
|
||||
pub fn new(
|
||||
blob_service: Arc<dyn BlobService>,
|
||||
directory_service: Arc<dyn DirectoryService>,
|
||||
path_info_service: PS,
|
||||
) -> Self {
|
||||
Self {
|
||||
blob_service,
|
||||
path_info_service,
|
||||
directory_service,
|
||||
path_info_service,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<BS: BlobService, DS: DirectoryService, PS: PathInfoService> fuser::Filesystem
|
||||
for FUSE<BS, DS, PS>
|
||||
{
|
||||
}
|
||||
impl<PS: PathInfoService> fuser::Filesystem for FUSE<PS> {}
|
||||
|
|
Loading…
Reference in a new issue