Remove canonicalization functionality from VFS and related components

- Eliminated the `canonicalize` method from the `VfsBackend` trait and its implementations in `InMemoryFs`, `NoopBackend`, and `StdBackend`, simplifying the interface and reducing complexity.
- Updated various parts of the codebase to remove references to canonicalization, including tests and prefetch cache handling, ensuring consistency across the project.
- Adjusted logging and comments to reflect the removal of path normalization logic, enhancing clarity and maintainability.

These changes aim to streamline the VFS implementation by focusing on core functionalities without the overhead of path canonicalization.
This commit is contained in:
Joe 2026-03-01 18:42:41 -06:00
parent 65f10f111c
commit fc8a6e9b9c
21 changed files with 123 additions and 440 deletions

View file

@ -241,22 +241,17 @@ fn parallel_snapshot_with_prefetch_cache() {
use std::collections::HashMap;
let mut files = HashMap::new();
let mut canonical = HashMap::new();
for entry in walkdir::WalkDir::new(root).follow_links(true) {
let entry = entry.unwrap();
let path = entry.path().to_path_buf();
if entry.file_type().is_file() {
files.insert(path.clone(), fs::read(&path).unwrap());
}
if let Ok(c) = fs::canonicalize(&path) {
canonical.insert(path, c);
}
}
let vfs_cached = memofs::Vfs::new_default();
vfs_cached.set_prefetch_cache(memofs::PrefetchCache {
files,
canonical,
is_file: std::collections::HashMap::new(),
children: std::collections::HashMap::new(),
});
@ -336,7 +331,6 @@ fn overlapping_path_roots_no_duplicate_children() {
use std::collections::HashMap;
let mut files = HashMap::new();
let mut canonical = HashMap::new();
let mut is_file = HashMap::new();
let mut children_map: HashMap<std::path::PathBuf, Vec<std::path::PathBuf>> = HashMap::new();
@ -347,9 +341,6 @@ fn overlapping_path_roots_no_duplicate_children() {
if entry.file_type().is_file() {
files.insert(path.clone(), fs::read(&path).unwrap());
}
if let Ok(c) = fs::canonicalize(&path) {
canonical.insert(path.clone(), c);
}
if entry.depth() > 0 {
if let Some(parent) = entry.path().parent() {
children_map
@ -366,7 +357,6 @@ fn overlapping_path_roots_no_duplicate_children() {
let vfs = memofs::Vfs::new_default();
vfs.set_prefetch_cache(memofs::PrefetchCache {
files,
canonical,
is_file,
children: children_map,
});