From 9c223450199b466c535f2b715ad68f1f295fa7dc Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 18 Oct 2024 14:41:14 +0200 Subject: refactor(tvix/[ca]store): use auto_impl This implements BS, DS, PS for Box'ed or Arc'ed variants of it with less code, and less potential to accidentially forget to proxy default trait methods for blanked impls, as fixed in cl/12658. Change-Id: If2cdbb563a73792038ebe7bff45d6f880214855b Reviewed-on: https://cl.tvl.fyi/c/depot/+/12661 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: edef --- tvix/castore/src/fs/fuse/tests.rs | 4 ++-- tvix/castore/src/fs/mod.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tvix/castore/src/fs') diff --git a/tvix/castore/src/fs/fuse/tests.rs b/tvix/castore/src/fs/fuse/tests.rs index 9e01204d5da7..0d68af090daf 100644 --- a/tvix/castore/src/fs/fuse/tests.rs +++ b/tvix/castore/src/fs/fuse/tests.rs @@ -45,8 +45,8 @@ fn do_mount, BS, DS>( show_xattr: bool, ) -> io::Result where - BS: AsRef + Send + Sync + Clone + 'static, - DS: AsRef + Send + Sync + Clone + 'static, + BS: BlobService + Send + Sync + Clone + 'static, + DS: DirectoryService + Send + Sync + Clone + 'static, { let fs = TvixStoreFs::new( blob_service, diff --git a/tvix/castore/src/fs/mod.rs b/tvix/castore/src/fs/mod.rs index d124c56297ed..58e01355e96d 100644 --- a/tvix/castore/src/fs/mod.rs +++ b/tvix/castore/src/fs/mod.rs @@ -121,8 +121,8 @@ pub struct TvixStoreFs { impl TvixStoreFs where - BS: AsRef + Clone + Send, - DS: AsRef + Clone + Send + 'static, + BS: BlobService + Clone + Send, + DS: DirectoryService + Clone + Send + 'static, RN: RootNodes + Clone + 'static, { pub fn new( @@ -186,7 +186,7 @@ where .block_on({ let directory_service = self.directory_service.clone(); let parent_digest = parent_digest.to_owned(); - async move { directory_service.as_ref().get(&parent_digest).await } + async move { directory_service.get(&parent_digest).await } })? .ok_or_else(|| { warn!(directory.digest=%parent_digest, "directory not found"); @@ -302,8 +302,8 @@ const XATTR_NAME_BLOB_DIGEST: &[u8] = b"user.tvix.castore.blob.digest"; impl Layer for TvixStoreFs where - BS: AsRef + Clone + Send + 'static, - DS: AsRef + Send + Clone + 'static, + BS: BlobService + Clone + Send + 'static, + DS: DirectoryService + Send + Clone + 'static, RN: RootNodes + Clone + 'static, { fn root_inode(&self) -> Self::Inode { @@ -313,8 +313,8 @@ where impl FileSystem for TvixStoreFs where - BS: AsRef + Clone + Send + 'static, - DS: AsRef + Send + Clone + 'static, + BS: BlobService + Clone + Send + 'static, + DS: DirectoryService + Send + Clone + 'static, RN: RootNodes + Clone + 'static, { type Handle = u64; @@ -674,7 +674,7 @@ where match self.tokio_handle.block_on({ let blob_service = self.blob_service.clone(); let blob_digest = blob_digest.clone(); - async move { blob_service.as_ref().open_read(&blob_digest).await } + async move { blob_service.open_read(&blob_digest).await } }) { Ok(None) => { warn!("blob not found"); -- cgit 1.4.1