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

Christian Ebner c.ebner at proxmox.com
Mon May 12 11:32:16 CEST 2025


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...




More information about the pbs-devel mailing list