cleanup: define/use const for predefined blob file names.

This commit is contained in:
Dietmar Maurer 2020-05-30 14:04:15 +02:00
parent 7cc3473a4e
commit 96d65fbcd0
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result<Vec<Ba
let mut path = store.base_path();
path.push(backup_dir.relative_path());
path.push("index.json.blob");
path.push(MANIFEST_BLOB_NAME);
let raw_data = file_get_contents(&path)?;
let index_size = raw_data.len() as u64;
@ -61,7 +61,7 @@ fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result<Vec<Ba
}
result.push(BackupContent {
filename: "index.json.blob".to_string(),
filename: MANIFEST_BLOB_NAME.to_string(),
size: Some(index_size),
});
@ -805,7 +805,7 @@ fn upload_backup_log(
let store = tools::required_string_param(&param, "store")?;
let datastore = DataStore::lookup_datastore(store)?;
let file_name = "client.log.blob";
let file_name = CLIENT_LOG_BLOB_NAME;
let backup_type = tools::required_string_param(&param, "backup-type")?;
let backup_id = tools::required_string_param(&param, "backup-id")?;

View File

@ -7,6 +7,7 @@ use serde_json::{json, Value};
use crate::backup::BackupDir;
pub const MANIFEST_BLOB_NAME: &str = "index.json.blob";
pub const CLIENT_LOG_BLOB_NAME: &str = "client.log.blob";
pub struct FileInfo {
pub filename: String,