This commit is contained in:
many 2020-10-15 12:18:15 +02:00
parent f1925b8f71
commit e6033e174d
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA
2 changed files with 4 additions and 4 deletions

View File

@ -245,7 +245,7 @@ fn generate_uid() -> String {
/// Infer dumps_dir from dump_uid /// Infer dumps_dir from dump_uid
pub fn compressed_dumps_dir(dumps_dir: &Path, dump_uid: &str) -> PathBuf { pub fn compressed_dumps_dir(dumps_dir: &Path, dump_uid: &str) -> PathBuf {
dumps_dir.join(format!("{}.tar.gz", dump_uid)) dumps_dir.join(format!("{}.dump", dump_uid))
} }
/// Write metadata in dump /// Write metadata in dump
@ -380,7 +380,7 @@ fn dump_process(data: web::Data<Data>, dumps_dir: PathBuf, dump_info: DumpInfo)
} }
} }
// compress dump in a file named `{dump_uid}.tar.gz` in `dumps_dir` // compress dump in a file named `{dump_uid}.dump` in `dumps_dir`
if let Err(e) = crate::helpers::compression::to_tar_gz(&tmp_dir_path, &compressed_dumps_dir(&dumps_dir, &dump_info.uid)) { if let Err(e) = crate::helpers::compression::to_tar_gz(&tmp_dir_path, &compressed_dumps_dir(&dumps_dir, &dump_info.uid)) {
fail_dump_process(dump_info, "compressing dump", e); fail_dump_process(dump_info, "compressing dump", e);
return ; return ;

View File

@ -42,7 +42,7 @@ pub fn schedule_snapshot(data: Data, snapshot_dir: &Path, time_gap_s: u64) -> Re
} }
let db_name = Path::new(&data.db_path).file_name().ok_or_else(|| Error::Internal("invalid database name".to_string()))?; let db_name = Path::new(&data.db_path).file_name().ok_or_else(|| Error::Internal("invalid database name".to_string()))?;
create_dir_all(snapshot_dir)?; create_dir_all(snapshot_dir)?;
let snapshot_path = snapshot_dir.join(format!("{}.tar.gz", db_name.to_str().unwrap_or("data.ms"))); let snapshot_path = snapshot_dir.join(format!("{}.snapshot", db_name.to_str().unwrap_or("data.ms")));
thread::spawn(move || loop { thread::spawn(move || loop {
thread::sleep(Duration::from_secs(time_gap_s)); thread::sleep(Duration::from_secs(time_gap_s));
@ -67,7 +67,7 @@ mod tests {
let test_dir = tempdir.path(); let test_dir = tempdir.path();
let src_dir = test_dir.join("src"); let src_dir = test_dir.join("src");
let dest_dir = test_dir.join("complex/destination/path/"); let dest_dir = test_dir.join("complex/destination/path/");
let archive_path = test_dir.join("archive.tar.gz"); let archive_path = test_dir.join("archive.snapshot");
let file_1_relative = Path::new("file1.txt"); let file_1_relative = Path::new("file1.txt");
let subdir_relative = Path::new("subdir/"); let subdir_relative = Path::new("subdir/");