feat: add dunce crate for optimized path resolution in LocalDisk

This commit is contained in:
reatang
2026-01-11 01:03:10 +08:00
parent e614e530cf
commit 813b48484d
4 changed files with 5 additions and 1 deletions

1
Cargo.lock generated
View File

@@ -7974,6 +7974,7 @@ dependencies = [
"bytesize",
"chrono",
"criterion",
"dunce",
"enumset",
"faster-hex",
"flatbuffers",

View File

@@ -184,6 +184,7 @@ criterion = { version = "0.8", features = ["html_reports"] }
crossbeam-queue = "0.3.12"
datafusion = "51.0.0"
derive_builder = "0.20.2"
dunce = "1.0.5"
enumset = "1.1.10"
faster-hex = "0.10.0"
flate2 = "1.1.5"

View File

@@ -108,6 +108,7 @@ google-cloud-storage = { workspace = true }
google-cloud-auth = { workspace = true }
aws-config = { workspace = true }
faster-hex = { workspace = true }
dunce = { workspace = true }
[dev-dependencies]

View File

@@ -129,7 +129,8 @@ impl LocalDisk {
pub async fn new(ep: &Endpoint, cleanup: bool) -> Result<Self> {
debug!("Creating local disk");
// Use optimized path resolution instead of absolutize() for better performance
let root = match std::fs::canonicalize(ep.get_file_path()) {
// Use dunce::canonicalize instead of std::fs::canonicalize to avoid UNC paths on Windows
let root = match dunce::canonicalize(ep.get_file_path()) {
Ok(path) => path,
Err(e) => {
if e.kind() == ErrorKind::NotFound {