about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-09-28T12·11+0200
committerclbot <clbot@tvl.fyi>2024-09-28T13·30+0000
commit1c24d483d5417131e8bae757594a8fbff6847ae8 (patch)
tree322cd309406c3ae3799901346360d7010e14bee1 /tvix
parent1034cc7774e553262d064124e633c8cffe134eac (diff)
chore(tvix/castore/fuse): impl Layer for TvixStoreFs r/8726
Allows using a TvixStoreFs in overlay filesystems

Change-Id: I10e63c92776b1c783947d92070f360865ef2883c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12539
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/castore/src/fs/mod.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tvix/castore/src/fs/mod.rs b/tvix/castore/src/fs/mod.rs
index 9c82b0a8c738..d124c56297ed 100644
--- a/tvix/castore/src/fs/mod.rs
+++ b/tvix/castore/src/fs/mod.rs
@@ -24,7 +24,7 @@ use crate::{
 use bstr::ByteVec;
 use fuse_backend_rs::abi::fuse_abi::{stat64, OpenOptions};
 use fuse_backend_rs::api::filesystem::{
-    Context, FileSystem, FsOptions, GetxattrReply, ListxattrReply, ROOT_ID,
+    Context, FileSystem, FsOptions, GetxattrReply, Layer, ListxattrReply, ROOT_ID,
 };
 use futures::StreamExt;
 use parking_lot::RwLock;
@@ -300,6 +300,17 @@ const ROOT_NODES_BUFFER_SIZE: usize = 16;
 const XATTR_NAME_DIRECTORY_DIGEST: &[u8] = b"user.tvix.castore.directory.digest";
 const XATTR_NAME_BLOB_DIGEST: &[u8] = b"user.tvix.castore.blob.digest";
 
+impl<BS, DS, RN> Layer for TvixStoreFs<BS, DS, RN>
+where
+    BS: AsRef<dyn BlobService> + Clone + Send + 'static,
+    DS: AsRef<dyn DirectoryService> + Send + Clone + 'static,
+    RN: RootNodes + Clone + 'static,
+{
+    fn root_inode(&self) -> Self::Inode {
+        ROOT_ID
+    }
+}
+
 impl<BS, DS, RN> FileSystem for TvixStoreFs<BS, DS, RN>
 where
     BS: AsRef<dyn BlobService> + Clone + Send + 'static,