src/api2/admin/datastore/backup/environment.rs: do not store path

This commit is contained in:
Dietmar Maurer 2019-05-11 12:13:44 +02:00
parent 51a4f63ff7
commit 6b95c7df07
2 changed files with 3 additions and 7 deletions

View File

@ -77,12 +77,12 @@ fn upgrade_to_backup_protocol(
let last_backup = BackupInfo::last_backup(&datastore.base_path(), &backup_group)?; let last_backup = BackupInfo::last_backup(&datastore.base_path(), &backup_group)?;
let backup_dir = BackupDir::new_with_group(backup_group, backup_time.timestamp()); 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."); } if !is_new { bail!("backup directorty already exists."); }
WorkerTask::spawn("backup", Some(worker_id), &username.clone(), true, move |worker| { WorkerTask::spawn("backup", Some(worker_id), &username.clone(), true, move |worker| {
let mut backup_env = BackupEnvironment::new( 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; backup_env.last_backup = last_backup;
@ -173,7 +173,7 @@ fn create_dynamic_index(
archive_name.push_str(".didx"); archive_name.push_str(".didx");
} }
let mut path = env.path.clone(); let mut path = env.backup_dir.relative_path();
path.push(archive_name); path.push(archive_name);
let chunk_size = 4096*1024; // todo: ?? let chunk_size = 4096*1024; // todo: ??

View File

@ -1,7 +1,6 @@
use failure::*; use failure::*;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf;
use serde_json::Value; use serde_json::Value;
@ -26,7 +25,6 @@ pub struct BackupEnvironment {
pub worker: Arc<WorkerTask>, pub worker: Arc<WorkerTask>,
pub datastore: Arc<DataStore>, pub datastore: Arc<DataStore>,
pub backup_dir: BackupDir, pub backup_dir: BackupDir,
pub path: PathBuf,
pub last_backup: Option<BackupInfo>, pub last_backup: Option<BackupInfo>,
state: Arc<Mutex<SharedBackupState>> state: Arc<Mutex<SharedBackupState>>
} }
@ -38,7 +36,6 @@ impl BackupEnvironment {
worker: Arc<WorkerTask>, worker: Arc<WorkerTask>,
datastore: Arc<DataStore>, datastore: Arc<DataStore>,
backup_dir: BackupDir, backup_dir: BackupDir,
path: PathBuf,
) -> Self { ) -> Self {
let state = SharedBackupState { let state = SharedBackupState {
@ -54,7 +51,6 @@ impl BackupEnvironment {
datastore, datastore,
formatter: &JSON_FORMATTER, formatter: &JSON_FORMATTER,
backup_dir, backup_dir,
path,
last_backup: None, last_backup: None,
state: Arc::new(Mutex::new(state)), state: Arc::new(Mutex::new(state)),
} }