src/backup/datastore.rs: protect BackupDir fields, impl new()

This commit is contained in:
Dietmar Maurer
2019-03-04 13:51:36 +01:00
parent 1e9a94e579
commit 9b492eb256
4 changed files with 34 additions and 34 deletions

View File

@ -77,13 +77,25 @@ impl BackupGroup {
#[derive(Debug)]
pub struct BackupDir {
/// Backup group
pub group: BackupGroup,
group: BackupGroup,
/// Backup timestamp
pub backup_time: DateTime<Local>,
backup_time: DateTime<Local>,
}
impl BackupDir {
pub fn new(group: BackupGroup, backup_time: DateTime<Local>) -> Self {
Self { group, backup_time }
}
pub fn group(&self) -> &BackupGroup {
&self.group
}
pub fn backup_time(&self) -> DateTime<Local> {
self.backup_time
}
pub fn parse(path: &str) -> Result<Self, Error> {
let cap = SNAPSHOT_PATH_REGEX.captures(path)