about summary refs log tree commit diff
path: root/tvix/castore/src/fs/tests.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-04-15T07·54+0300
committerclbot <clbot@tvl.fyi>2024-04-15T13·18+0000
commit2a47ad1d902c44f3986ef1fcd7770d73d54b0904 (patch)
treeb9b65c74d335f03f835b25045e097f48f1344b62 /tvix/castore/src/fs/tests.rs
parent3ed7eda79b53d5e03e32d7198508a356ee9af69e (diff)
feat(tvix/castore/fs): implement opendir/releasedir r/7915
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 <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/src/fs/tests.rs')
-rw-r--r--tvix/castore/src/fs/tests.rs10
1 files changed, 2 insertions, 8 deletions
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());
     }