From 281bd46a43437c02435a67239c47994b7636ba66 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 5 May 2024 11:08:59 +0300 Subject: feat(tvix-castore/import) have IngestionEntry.path() return &Path There's no need for this to be a &PathBuf. Change-Id: I2d4126d57cfd8ddaad5dd327943b70b83d45c749 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11589 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster --- tvix/castore/src/import/archive.rs | 4 ++-- tvix/castore/src/import/mod.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tvix/castore/src/import/archive.rs b/tvix/castore/src/import/archive.rs index 0d21481d4..0ebb4a236 100644 --- a/tvix/castore/src/import/archive.rs +++ b/tvix/castore/src/import/archive.rs @@ -288,12 +288,12 @@ impl IngestionEntryGraph { None => self.graph.add_node(entry), }; - // A path with 1 component is the root node + // for archives, a path with 1 component is the root node if path.components().count() == 1 { // We expect archives to contain a single root node, if there is another root node // entry with a different path name, this is unsupported. if let Some(root_node) = self.root_node { - if self.get_node(root_node).path() != &path { + if self.get_node(root_node).path() != path.as_ref() { return Err(Error::UnexpectedNumberOfTopLevelEntries); } } diff --git a/tvix/castore/src/import/mod.rs b/tvix/castore/src/import/mod.rs index 7b42644a2..6c69d04f3 100644 --- a/tvix/castore/src/import/mod.rs +++ b/tvix/castore/src/import/mod.rs @@ -13,6 +13,7 @@ use crate::proto::DirectoryNode; use crate::proto::FileNode; use crate::proto::SymlinkNode; use crate::B3Digest; +use crate::Path; use futures::{Stream, StreamExt}; use tracing::Level; @@ -183,7 +184,7 @@ pub enum IngestionEntry { } impl IngestionEntry { - fn path(&self) -> &PathBuf { + fn path(&self) -> &Path { match self { IngestionEntry::Regular { path, .. } => path, IngestionEntry::Symlink { path, .. } => path, -- cgit 1.4.1