From 77546d734efe704f52a4c89b5159cb2d98d5a8aa Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 30 Apr 2024 17:06:57 +0300 Subject: refactor(tvix/castore): remove IngestionEntry::Unknown 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 Tested-by: BuildkiteCI Reviewed-by: firefly --- tvix/castore/src/import/fs.rs | 2 +- tvix/castore/src/import/mod.rs | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'tvix/castore/src') 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, } } -- cgit 1.4.1