[pbs-devel] [PATCH proxmox-backup 1/2] api types: version: add helper for min version checks

Christian Ebner c.ebner at proxmox.com
Thu Nov 28 14:49:14 CET 2024


On 11/28/24 14:18, Thomas Lamprecht wrote:
> Am 28.11.24 um 14:14 schrieb Christian Ebner:
>> On 11/28/24 14:10, Thomas Lamprecht wrote:
>>> Why not impl the Ord trait here instead?
>>>
>>> Then the call-site could be
>>>
>>> let supports_prune_delete_stats = api_version >= ApiVersion::new(3, 2, 11, String::new());
>>
>> Ah, yes that's way nicer and allows also for exact version matching.
>>
>>> And maybe a separate type for the triple without the commit hash on which you
>>> also impl the same and then avoid that slightly confusing String::new() hack.
>>
>> Acked, will send a new version incorporating your feedback, thanks!
>>
> 
> Note that while I'm quite sure of the first thing the last thing was just a
> idea from top of my head, not sure how much it improves,  but maybe having
> a separate VersionTriple or SemanticVersion type might make a few things nicer
> to use.

Okay, well I was rather opting for dropping the `repoid` from 
`ApiVersion` instead of introducing another type, as that is currently 
not used and was just included for completeness. The `repoid` can 
already be obtained directly from the `ApiVersionInfo`, returned by the 
version api endpoint so this information is redundant anyways.




More information about the pbs-devel mailing list