rename BackupDir's group_path to relative_group_path
datastore's group_path will be moved to BackupDir soon and this is required to be able to properly distinguish them Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b444eb68af
commit
1f6a45c938
|
@ -60,7 +60,7 @@ impl BackupGroup {
|
|||
&self.backup_id
|
||||
}
|
||||
|
||||
pub fn group_path(&self) -> PathBuf {
|
||||
pub fn relative_group_path(&self) -> PathBuf {
|
||||
let mut relative_path = PathBuf::new();
|
||||
|
||||
relative_path.push(self.backup_type.as_str());
|
||||
|
@ -74,7 +74,7 @@ impl BackupGroup {
|
|||
let mut list = vec![];
|
||||
|
||||
let mut path = base_path.to_owned();
|
||||
path.push(self.group_path());
|
||||
path.push(self.relative_group_path());
|
||||
|
||||
proxmox_sys::fs::scandir(
|
||||
libc::AT_FDCWD,
|
||||
|
@ -120,7 +120,7 @@ impl BackupGroup {
|
|||
let mut last = None;
|
||||
|
||||
let mut path = base_path.to_owned();
|
||||
path.push(self.group_path());
|
||||
path.push(self.relative_group_path());
|
||||
|
||||
proxmox_sys::fs::scandir(
|
||||
libc::AT_FDCWD,
|
||||
|
@ -283,7 +283,7 @@ impl BackupDir {
|
|||
}
|
||||
|
||||
pub fn relative_path(&self) -> PathBuf {
|
||||
let mut relative_path = self.group.group_path();
|
||||
let mut relative_path = self.group.relative_group_path();
|
||||
|
||||
relative_path.push(self.backup_time_string.clone());
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ impl DataStore {
|
|||
/// Returns the absolute path for a backup_group
|
||||
pub fn group_path(&self, backup_group: &BackupGroup) -> PathBuf {
|
||||
let mut full_path = self.base_path();
|
||||
full_path.push(backup_group.group_path());
|
||||
full_path.push(backup_group.relative_group_path());
|
||||
full_path
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ impl DataStore {
|
|||
pub fn last_successful_backup(&self, backup_group: &BackupGroup) -> Result<Option<i64>, Error> {
|
||||
let base_path = self.base_path();
|
||||
let mut group_path = base_path.clone();
|
||||
group_path.push(backup_group.group_path());
|
||||
group_path.push(backup_group.relative_group_path());
|
||||
|
||||
if group_path.exists() {
|
||||
backup_group.last_successful_backup(&base_path)
|
||||
|
@ -438,7 +438,7 @@ impl DataStore {
|
|||
/// The backup owner is the entity who first created the backup group.
|
||||
pub fn get_owner(&self, backup_group: &BackupGroup) -> Result<Authid, Error> {
|
||||
let mut full_path = self.base_path();
|
||||
full_path.push(backup_group.group_path());
|
||||
full_path.push(backup_group.relative_group_path());
|
||||
full_path.push("owner");
|
||||
let owner = proxmox_sys::fs::file_read_firstline(full_path)?;
|
||||
owner.trim_end().parse() // remove trailing newline
|
||||
|
@ -458,7 +458,7 @@ impl DataStore {
|
|||
force: bool,
|
||||
) -> Result<(), Error> {
|
||||
let mut path = self.base_path();
|
||||
path.push(backup_group.group_path());
|
||||
path.push(backup_group.relative_group_path());
|
||||
path.push("owner");
|
||||
|
||||
let mut open_options = std::fs::OpenOptions::new();
|
||||
|
|
|
@ -156,7 +156,7 @@ pub async fn api_datastore_latest_snapshot(
|
|||
if list.is_empty() {
|
||||
bail!(
|
||||
"backup group {:?} does not contain any snapshots.",
|
||||
group.group_path()
|
||||
group.relative_group_path()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ async fn list_backup_groups(param: Value) -> Result<Value, Error> {
|
|||
let render_group_path = |_v: &Value, record: &Value| -> Result<String, Error> {
|
||||
let item: GroupListItem = serde_json::from_value(record.to_owned())?;
|
||||
let group = BackupGroup::new(item.backup.ty, item.backup.id);
|
||||
Ok(group.group_path().to_str().unwrap().to_owned())
|
||||
Ok(group.relative_group_path().to_str().unwrap().to_owned())
|
||||
};
|
||||
|
||||
let render_last_backup = |_v: &Value, record: &Value| -> Result<String, Error> {
|
||||
|
|
|
@ -65,7 +65,7 @@ const GROUP_NOTES_FILE_NAME: &str = "notes";
|
|||
|
||||
fn get_group_note_path(store: &DataStore, group: &BackupGroup) -> PathBuf {
|
||||
let mut note_path = store.base_path();
|
||||
note_path.push(group.group_path());
|
||||
note_path.push(group.relative_group_path());
|
||||
note_path.push(GROUP_NOTES_FILE_NAME);
|
||||
note_path
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue