add Display trait to BackupDir
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
3b62116ce6
commit
abdb976340
|
@ -1,7 +1,6 @@
|
|||
use std::collections::{HashSet, HashMap};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use chrono::{TimeZone, Local};
|
||||
use anyhow::{bail, Error};
|
||||
use futures::*;
|
||||
use hyper::http::request::Parts;
|
||||
|
@ -748,8 +747,7 @@ fn download_file(
|
|||
let allowed = (user_privs & PRIV_DATASTORE_READ) != 0;
|
||||
if !allowed { check_backup_owner(&datastore, backup_dir.group(), &username)?; }
|
||||
|
||||
println!("Download {} from {} ({}/{}/{}/{})", file_name, store,
|
||||
backup_type, backup_id, Local.timestamp(backup_time, 0), file_name);
|
||||
println!("Download {} from {} ({}/{})", file_name, store, backup_dir, file_name);
|
||||
|
||||
let mut path = datastore.base_path();
|
||||
path.push(backup_dir.relative_path());
|
||||
|
|
|
@ -212,6 +212,15 @@ impl BackupDir {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for BackupDir {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let backup_type = self.group.backup_type();
|
||||
let id = self.group.backup_id();
|
||||
let time = Self::backup_time_to_string(self.backup_time);
|
||||
write!(f, "{}/{}/{}", backup_type, id, time)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<(BackupGroup, i64)> for BackupDir {
|
||||
fn from((group, timestamp): (BackupGroup, i64)) -> Self {
|
||||
Self { group, backup_time: Utc.timestamp(timestamp, 0) }
|
||||
|
|
Loading…
Reference in New Issue