[pbs-devel] [RFC v2 proxmox-backup 03/21] datastore: allow filtering of backups by their trash status

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon May 12 12:08:34 CEST 2025


> Christian Ebner <c.ebner at proxmox.com> hat am 12.05.2025 11:32 CEST geschrieben:
> 
>  
> On 5/9/25 14:27, Fabian Grünbichler wrote:
> > On May 8, 2025 3:05 pm, Christian Ebner wrote:
> >> Extends the BackupGroup::list_backups method by an enum parameter to
> >> filter backup snapshots based on their trash status.
> >>
> >> This allows to reuse the same logic for listing active, trashed or
> >> all snapshots.
> >>
> >> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> >> ---
> >>   pbs-datastore/src/backup_info.rs | 33 +++++++++++++++++++++++++++++---
> >>   pbs-datastore/src/datastore.rs   |  4 ++--
> >>   src/api2/admin/datastore.rs      | 10 +++++-----
> >>   src/api2/tape/backup.rs          |  4 ++--
> >>   src/backup/verify.rs             |  4 ++--
> >>   src/server/prune_job.rs          |  3 ++-
> >>   src/server/pull.rs               |  3 ++-
> >>   7 files changed, 45 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
> >> index 9ce4cb0f8..a8c864ac8 100644
> >> --- a/pbs-datastore/src/backup_info.rs
> >> +++ b/pbs-datastore/src/backup_info.rs
> >> @@ -52,6 +52,12 @@ impl fmt::Debug for BackupGroup {
> >>       }
> >>   }
> >>   
> >> +pub enum ListBackupFilter {
> >> +    Active,
> > 
> > active sounds like there's currently a backup going on..
> > 
> >> +    All,
> >> +    Trashed,
> >> +}
> 
> True, I might rename the enum and it's variants to
> 
> pub enum TrashStateFilter {
>      All,
>      NotTrashed,
>      Trashed,
> }
> 
> and use that for both, snapshot and namespace filtering.
> 
> Although a bit thorn, I do dislike the `NotTrashed` but fail to come up 
> with a more striking name...

IncludeTrash (list all snapshots, including trash)
ExcludeTrash (the backwards compat default?)
OnlyTrash (list only the trashed snapshots, for a 'trash can' view)

might work?

or else, `Regular` for non-trash snapshots? `Trash` might also be nicer
than `Trashed`.




More information about the pbs-devel mailing list