feat: get absolute path for dfdaemon import file (#974)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2025-02-11 18:41:16 +08:00 committed by GitHub
parent 4407ecd2fd
commit a33f861443
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

16
Cargo.lock generated
View File

@ -938,7 +938,7 @@ dependencies = [
[[package]]
name = "dragonfly-client"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"anyhow",
"blake3",
@ -1010,7 +1010,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-backend"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"dragonfly-api",
"dragonfly-client-core",
@ -1041,7 +1041,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-config"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"bytesize",
"bytesize-serde",
@ -1067,7 +1067,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-core"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"headers 0.4.0",
"hyper 1.5.2",
@ -1086,7 +1086,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-init"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"anyhow",
"clap",
@ -1104,7 +1104,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-storage"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"base16ct",
"bincode",
@ -1130,7 +1130,7 @@ dependencies = [
[[package]]
name = "dragonfly-client-util"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"base16ct",
"base64 0.22.1",
@ -1532,7 +1532,7 @@ dependencies = [
[[package]]
name = "hdfs"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"dragonfly-client-backend",
"dragonfly-client-core",

View File

@ -12,7 +12,7 @@ members = [
]
[workspace.package]
version = "0.2.8"
version = "0.2.9"
authors = ["The Dragonfly Developers"]
homepage = "https://d7y.io/"
repository = "https://github.com/dragonflyoss/client.git"
@ -22,13 +22,13 @@ readme = "README.md"
edition = "2021"
[workspace.dependencies]
dragonfly-client = { path = "dragonfly-client", version = "0.2.8" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.8" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.8" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.8" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.8" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.8" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.8" }
dragonfly-client = { path = "dragonfly-client", version = "0.2.9" }
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.9" }
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.9" }
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.9" }
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.9" }
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.9" }
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.9" }
thiserror = "1.0"
dragonfly-api = "=2.1.23"
reqwest = { version = "0.12.4", features = [

View File

@ -429,7 +429,7 @@ impl ExportCommand {
(None, true)
} else {
let absolute_path = Path::new(&self.output).absolutize()?;
info!("download file to: {}", absolute_path.to_string_lossy());
info!("export file to: {}", absolute_path.to_string_lossy());
(Some(absolute_path.to_string_lossy().to_string()), false)
};

View File

@ -22,9 +22,11 @@ use dragonfly_client_core::{
Error, Result,
};
use indicatif::{ProgressBar, ProgressStyle};
use std::path::PathBuf;
use path_absolutize::*;
use std::path::{Path, PathBuf};
use std::time::Duration;
use termion::{color, style};
use tracing::info;
use super::*;
@ -317,6 +319,9 @@ impl ImportCommand {
/// run runs the import sub command.
async fn run(&self, dfdaemon_download_client: DfdaemonDownloadClient) -> Result<()> {
let absolute_path = Path::new(&self.path).absolutize()?;
info!("import file: {}", absolute_path.to_string_lossy());
let pb = ProgressBar::new_spinner();
pb.enable_steady_tick(DEFAULT_PROGRESS_BAR_STEADY_TICK_INTERVAL);
pb.set_style(
@ -329,7 +334,7 @@ impl ImportCommand {
let persistent_cache_task = dfdaemon_download_client
.upload_persistent_cache_task(UploadPersistentCacheTaskRequest {
task_id: self.id.clone(),
path: self.path.clone().into_os_string().into_string().unwrap(),
path: absolute_path.to_string_lossy().to_string(),
persistent_replica_count: self.persistent_replica_count,
tag: self.tag.clone(),
application: self.application.clone(),