datastore: add backup_ns accessor

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-04-25 10:42:23 +02:00 committed by Thomas Lamprecht
parent 8c74349b08
commit 11ffd737e3
1 changed files with 15 additions and 1 deletions

View File

@ -7,7 +7,9 @@ use anyhow::{bail, format_err, Error};
use proxmox_sys::fs::lock_dir_noblock; use proxmox_sys::fs::lock_dir_noblock;
use pbs_api_types::{BackupType, GroupFilter, BACKUP_DATE_REGEX, BACKUP_FILE_REGEX}; use pbs_api_types::{
BackupNamespace, BackupType, GroupFilter, BACKUP_DATE_REGEX, BACKUP_FILE_REGEX,
};
use pbs_config::{open_backup_lockfile, BackupLockGuard}; use pbs_config::{open_backup_lockfile, BackupLockGuard};
use crate::manifest::{MANIFEST_BLOB_NAME, MANIFEST_LOCK_NAME}; use crate::manifest::{MANIFEST_BLOB_NAME, MANIFEST_LOCK_NAME};
@ -41,10 +43,17 @@ impl BackupGroup {
&self.group &self.group
} }
#[inline]
pub fn backup_ns(&self) -> &BackupNamespace {
&self.group.ns
}
#[inline]
pub fn backup_type(&self) -> BackupType { pub fn backup_type(&self) -> BackupType {
self.group.ty self.group.ty
} }
#[inline]
pub fn backup_id(&self) -> &str { pub fn backup_id(&self) -> &str {
&self.group.id &self.group.id
} }
@ -295,6 +304,11 @@ impl BackupDir {
}) })
} }
#[inline]
pub fn backup_ns(&self) -> &BackupNamespace {
&self.dir.group.ns
}
#[inline] #[inline]
pub fn backup_type(&self) -> BackupType { pub fn backup_type(&self) -> BackupType {
self.dir.group.ty self.dir.group.ty