From 6b95c7df072f873f727a42ce041d383df19007e8 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 11 May 2019 12:13:44 +0200 Subject: [PATCH] src/api2/admin/datastore/backup/environment.rs: do not store path --- src/api2/admin/datastore/backup.rs | 6 +++--- src/api2/admin/datastore/backup/environment.rs | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/api2/admin/datastore/backup.rs b/src/api2/admin/datastore/backup.rs index 2255df15..06dcacc3 100644 --- a/src/api2/admin/datastore/backup.rs +++ b/src/api2/admin/datastore/backup.rs @@ -77,12 +77,12 @@ fn upgrade_to_backup_protocol( let last_backup = BackupInfo::last_backup(&datastore.base_path(), &backup_group)?; let backup_dir = BackupDir::new_with_group(backup_group, backup_time.timestamp()); - let (path, is_new) = datastore.create_backup_dir(&backup_dir)?; + let (_path, is_new) = datastore.create_backup_dir(&backup_dir)?; if !is_new { bail!("backup directorty already exists."); } WorkerTask::spawn("backup", Some(worker_id), &username.clone(), true, move |worker| { let mut backup_env = BackupEnvironment::new( - env_type, username.clone(), worker.clone(), datastore, backup_dir, path); + env_type, username.clone(), worker.clone(), datastore, backup_dir); backup_env.last_backup = last_backup; @@ -173,7 +173,7 @@ fn create_dynamic_index( archive_name.push_str(".didx"); } - let mut path = env.path.clone(); + let mut path = env.backup_dir.relative_path(); path.push(archive_name); let chunk_size = 4096*1024; // todo: ?? diff --git a/src/api2/admin/datastore/backup/environment.rs b/src/api2/admin/datastore/backup/environment.rs index 04c5a209..8f569aa7 100644 --- a/src/api2/admin/datastore/backup/environment.rs +++ b/src/api2/admin/datastore/backup/environment.rs @@ -1,7 +1,6 @@ use failure::*; use std::sync::{Arc, Mutex}; use std::collections::HashMap; -use std::path::PathBuf; use serde_json::Value; @@ -26,7 +25,6 @@ pub struct BackupEnvironment { pub worker: Arc, pub datastore: Arc, pub backup_dir: BackupDir, - pub path: PathBuf, pub last_backup: Option, state: Arc> } @@ -38,7 +36,6 @@ impl BackupEnvironment { worker: Arc, datastore: Arc, backup_dir: BackupDir, - path: PathBuf, ) -> Self { let state = SharedBackupState { @@ -54,7 +51,6 @@ impl BackupEnvironment { datastore, formatter: &JSON_FORMATTER, backup_dir, - path, last_backup: None, state: Arc::new(Mutex::new(state)), }