about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-04-30T14·06+0300
committerclbot <clbot@tvl.fyi>2024-04-30T15·53+0000
commit77546d734efe704f52a4c89b5159cb2d98d5a8aa (patch)
tree6f2e50156f98bbc78fe33d4759badfeeb060cecd
parent4c5c810c6fe998e84a00c1bfcb3ffde8a9646e7e (diff)
refactor(tvix/castore): remove IngestionEntry::Unknown r/8047
We shouldn't try to represent non-representable things in the ingestion
entries (only to throw an error).

It's cleaner to throw the error directly in the part producing the
stream.

Change-Id: I6b6f6d8c2f677425210142a39f1829ddeefec812
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11556
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: firefly <firefly@firefly.nu>
-rw-r--r--tvix/castore/src/import/fs.rs2
-rw-r--r--tvix/castore/src/import/mod.rs9
2 files changed, 1 insertions, 10 deletions
diff --git a/tvix/castore/src/import/fs.rs b/tvix/castore/src/import/fs.rs
index 13e4a78cb799..6eab245f5500 100644
--- a/tvix/castore/src/import/fs.rs
+++ b/tvix/castore/src/import/fs.rs
@@ -130,7 +130,7 @@ where
             digest,
         })
     } else {
-        Ok(IngestionEntry::Unknown { path, file_type })
+        return Err(Error::UnsupportedFileType(path, file_type));
     }
 }
 
diff --git a/tvix/castore/src/import/mod.rs b/tvix/castore/src/import/mod.rs
index fb3d4a668632..d2234846dcbc 100644
--- a/tvix/castore/src/import/mod.rs
+++ b/tvix/castore/src/import/mod.rs
@@ -13,7 +13,6 @@ use crate::proto::FileNode;
 use crate::proto::SymlinkNode;
 use crate::B3Digest;
 use futures::{Stream, StreamExt};
-use std::fs::FileType;
 
 use tracing::Level;
 
@@ -126,9 +125,6 @@ where
                 size: *size,
                 executable: *executable,
             }),
-            IngestionEntry::Unknown { path, file_type } => {
-                return Err(Error::UnsupportedFileType(path.clone(), *file_type));
-            }
         };
 
         if entry.path().components().count() == 1 {
@@ -188,10 +184,6 @@ pub enum IngestionEntry {
     Dir {
         path: PathBuf,
     },
-    Unknown {
-        path: PathBuf,
-        file_type: FileType,
-    },
 }
 
 impl IngestionEntry {
@@ -200,7 +192,6 @@ impl IngestionEntry {
             IngestionEntry::Regular { path, .. } => path,
             IngestionEntry::Symlink { path, .. } => path,
             IngestionEntry::Dir { path } => path,
-            IngestionEntry::Unknown { path, .. } => path,
         }
     }