Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: get absolute path for dfdaemon import file #974

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion dragonfly-client/src/bin/dfcache/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};

Expand Down
9 changes: 7 additions & 2 deletions dragonfly-client/src/bin/dfcache/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down Expand Up @@ -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(
Expand All @@ -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(),
Expand Down