From 2a47ad1d902c44f3986ef1fcd7770d73d54b0904 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 15 Apr 2024 10:54:23 +0300 Subject: feat(tvix/castore/fs): implement opendir/releasedir Similar to how we already handle opening files, implement opendir/ releasedir, and keep a map of dir_handles. They point to the rx side of a channel. This greatly improves performance listing the root of the filesystem when used inside tvix-store, as we don't need to re-request the listing (and skip to the desired position) all the time. Change-Id: I0d3ec4cb70a8792c5a1343439cf47d78d9cbb1d6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11425 Autosubmit: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/castore/src/fs/tests.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'tvix/castore/src/fs/tests.rs') diff --git a/tvix/castore/src/fs/tests.rs b/tvix/castore/src/fs/tests.rs index 226c9975d5..d6eeb8a411 100644 --- a/tvix/castore/src/fs/tests.rs +++ b/tvix/castore/src/fs/tests.rs @@ -281,14 +281,8 @@ async fn root() { .expect("must succeed"); { - // read_dir succeeds, but getting the first element will fail. - let mut it = ReadDirStream::new(tokio::fs::read_dir(tmpdir).await.expect("must succeed")); - - let err = it - .next() - .await - .expect("must be some") - .expect_err("must be err"); + // read_dir fails (as opendir fails). + let err = tokio::fs::read_dir(tmpdir).await.expect_err("must fail"); assert_eq!(std::io::ErrorKind::PermissionDenied, err.kind()); } -- cgit 1.4.1