From 515bfa18fbe2e4031ffb1ea1a5a45f67540856d5 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 14 Apr 2024 18:01:24 +0300 Subject: feat(tvix/castore/fs): support extended attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This exposes `user.tvix.castore.{blob,directory}.digest` xattr keys for files and directories: ``` ❯ getfattr -d /tmp/tvix/06jrrv6wwp0nc1m7fr5bgdw012rfzfx2-nano-7.2-info getfattr: Removing leading '/' from absolute path names user.tvix.castore.directory.digest="b3:SuYDcUM9RpWcnA40tYB1BtYpR0xw72v3ymhKDQbBfe4=" ❯ getfattr -d /tmp/tvix/156a89x10c3kaby9rgf3fi4k0p6r9wl1-etc-shells getfattr: Removing leading '/' from absolute path names user.tvix.castore.blob.digest="b3:pZkwZoHN+/VQ8wkaX0wYVXZ0tV/HhtKlSqiaWDK7uRs=" ``` It's currently mostly used for debugging, though it might be useful for tvix-castore-aware syncing programs using the filesystem too. Change-Id: I26ac3cb9fe51ffbf7f880519f26741549cb5ab6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/11422 Autosubmit: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI Reviewed-by: Brian Olsen --- tvix/store/src/bin/tvix-store.rs | 12 ++++++++++++ tvix/store/src/pathinfoservice/fs/mod.rs | 2 ++ 2 files changed, 14 insertions(+) (limited to 'tvix/store') diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index a5845c74aed0..15f37d301f9d 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -161,6 +161,10 @@ enum Commands { /// (exhaustive) listing. #[clap(long, short, action)] list_root: bool, + + #[arg(long, default_value_t = true)] + /// Whether to expose blob and directory digests as extended attributes. + show_xattr: bool, }, /// Starts a tvix-store virtiofs daemon at the given socket path. #[cfg(feature = "virtiofs")] @@ -183,6 +187,10 @@ enum Commands { /// (exhaustive) listing. #[clap(long, short, action)] list_root: bool, + + #[arg(long, default_value_t = true)] + /// Whether to expose blob and directory digests as extended attributes. + show_xattr: bool, }, } @@ -459,6 +467,7 @@ async fn main() -> Result<(), Box> { list_root, threads, allow_other, + show_xattr, } => { let (blob_service, directory_service, path_info_service) = tvix_store::utils::construct_services( @@ -474,6 +483,7 @@ async fn main() -> Result<(), Box> { directory_service, Arc::from(path_info_service), list_root, + show_xattr, ); info!(mount_path=?dest, "mounting"); @@ -499,6 +509,7 @@ async fn main() -> Result<(), Box> { directory_service_addr, path_info_service_addr, list_root, + show_xattr, } => { let (blob_service, directory_service, path_info_service) = tvix_store::utils::construct_services( @@ -514,6 +525,7 @@ async fn main() -> Result<(), Box> { directory_service, Arc::from(path_info_service), list_root, + show_xattr, ); info!(socket_path=?socket, "starting virtiofs-daemon"); diff --git a/tvix/store/src/pathinfoservice/fs/mod.rs b/tvix/store/src/pathinfoservice/fs/mod.rs index 45d59fd0bcb8..aa64b1c01f16 100644 --- a/tvix/store/src/pathinfoservice/fs/mod.rs +++ b/tvix/store/src/pathinfoservice/fs/mod.rs @@ -17,6 +17,7 @@ pub fn make_fs( directory_service: DS, path_info_service: PS, list_root: bool, + show_xattr: bool, ) -> TvixStoreFs> where BS: AsRef + Send + Clone + 'static, @@ -28,6 +29,7 @@ where directory_service, RootNodesWrapper(path_info_service), list_root, + show_xattr, ) } -- cgit 1.4.1