[pbs-devel] [RFC v2 proxmox-backup 07/21] sync: ignore trashed groups in local source reader

Christian Ebner c.ebner at proxmox.com
Thu May 8 15:05:41 CEST 2025


Check and exclude backup groups which have been marked as trash from
sync.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 pbs-datastore/src/backup_info.rs | 7 +++++++
 src/server/sync.rs               | 1 +
 2 files changed, 8 insertions(+)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index 189ed28ad..b4fabb2cc 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -105,6 +105,13 @@ impl BackupGroup {
         self.full_group_path().exists()
     }
 
+    /// Check if the group is currently marked as trash by checking the presence of the trash
+    /// marker file in the group's directory
+    pub fn is_trashed(&self) -> bool {
+        let path = self.full_group_path().join(TRASH_MARKER_FILENAME);
+        path.exists()
+    }
+
     pub fn list_backups(&self, filter: ListBackupFilter) -> Result<Vec<BackupInfo>, Error> {
         let mut list = vec![];
 
diff --git a/src/server/sync.rs b/src/server/sync.rs
index 3de2ec9a4..ce338fbbe 100644
--- a/src/server/sync.rs
+++ b/src/server/sync.rs
@@ -447,6 +447,7 @@ impl SyncSource for LocalSource {
             Some(owner),
         )?
         .filter_map(Result::ok)
+        .filter(|backup_group| !backup_group.is_trashed())
         .map(|backup_group| backup_group.group().clone())
         .collect::<Vec<pbs_api_types::BackupGroup>>())
     }
-- 
2.39.5





More information about the pbs-devel mailing list