feat: get absolute path for dfdaemon import file (#974)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
4407ecd2fd
commit
a33f861443
|
|
@ -938,7 +938,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client"
|
name = "dragonfly-client"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
|
@ -1010,7 +1010,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-backend"
|
name = "dragonfly-client-backend"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dragonfly-api",
|
"dragonfly-api",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
|
@ -1041,7 +1041,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-config"
|
name = "dragonfly-client-config"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytesize",
|
"bytesize",
|
||||||
"bytesize-serde",
|
"bytesize-serde",
|
||||||
|
|
@ -1067,7 +1067,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-core"
|
name = "dragonfly-client-core"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"headers 0.4.0",
|
"headers 0.4.0",
|
||||||
"hyper 1.5.2",
|
"hyper 1.5.2",
|
||||||
|
|
@ -1086,7 +1086,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-init"
|
name = "dragonfly-client-init"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
@ -1104,7 +1104,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-storage"
|
name = "dragonfly-client-storage"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base16ct",
|
"base16ct",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
|
@ -1130,7 +1130,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dragonfly-client-util"
|
name = "dragonfly-client-util"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base16ct",
|
"base16ct",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
|
@ -1532,7 +1532,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hdfs"
|
name = "hdfs"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dragonfly-client-backend",
|
"dragonfly-client-backend",
|
||||||
"dragonfly-client-core",
|
"dragonfly-client-core",
|
||||||
|
|
|
||||||
16
Cargo.toml
16
Cargo.toml
|
|
@ -12,7 +12,7 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
authors = ["The Dragonfly Developers"]
|
authors = ["The Dragonfly Developers"]
|
||||||
homepage = "https://d7y.io/"
|
homepage = "https://d7y.io/"
|
||||||
repository = "https://github.com/dragonflyoss/client.git"
|
repository = "https://github.com/dragonflyoss/client.git"
|
||||||
|
|
@ -22,13 +22,13 @@ readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
dragonfly-client = { path = "dragonfly-client", version = "0.2.8" }
|
dragonfly-client = { path = "dragonfly-client", version = "0.2.9" }
|
||||||
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.8" }
|
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.2.9" }
|
||||||
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.8" }
|
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.2.9" }
|
||||||
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.8" }
|
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.2.9" }
|
||||||
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.8" }
|
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.2.9" }
|
||||||
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.8" }
|
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.2.9" }
|
||||||
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.8" }
|
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.2.9" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
dragonfly-api = "=2.1.23"
|
dragonfly-api = "=2.1.23"
|
||||||
reqwest = { version = "0.12.4", features = [
|
reqwest = { version = "0.12.4", features = [
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ impl ExportCommand {
|
||||||
(None, true)
|
(None, true)
|
||||||
} else {
|
} else {
|
||||||
let absolute_path = Path::new(&self.output).absolutize()?;
|
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)
|
(Some(absolute_path.to_string_lossy().to_string()), false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,11 @@ use dragonfly_client_core::{
|
||||||
Error, Result,
|
Error, Result,
|
||||||
};
|
};
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use std::path::PathBuf;
|
use path_absolutize::*;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use termion::{color, style};
|
use termion::{color, style};
|
||||||
|
use tracing::info;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
@ -317,6 +319,9 @@ impl ImportCommand {
|
||||||
|
|
||||||
/// run runs the import sub command.
|
/// run runs the import sub command.
|
||||||
async fn run(&self, dfdaemon_download_client: DfdaemonDownloadClient) -> Result<()> {
|
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();
|
let pb = ProgressBar::new_spinner();
|
||||||
pb.enable_steady_tick(DEFAULT_PROGRESS_BAR_STEADY_TICK_INTERVAL);
|
pb.enable_steady_tick(DEFAULT_PROGRESS_BAR_STEADY_TICK_INTERVAL);
|
||||||
pb.set_style(
|
pb.set_style(
|
||||||
|
|
@ -329,7 +334,7 @@ impl ImportCommand {
|
||||||
let persistent_cache_task = dfdaemon_download_client
|
let persistent_cache_task = dfdaemon_download_client
|
||||||
.upload_persistent_cache_task(UploadPersistentCacheTaskRequest {
|
.upload_persistent_cache_task(UploadPersistentCacheTaskRequest {
|
||||||
task_id: self.id.clone(),
|
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,
|
persistent_replica_count: self.persistent_replica_count,
|
||||||
tag: self.tag.clone(),
|
tag: self.tag.clone(),
|
||||||
application: self.application.clone(),
|
application: self.application.clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue