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

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Nov 28 14:50:20 CET 2024


Am 28.11.24 um 14:49 schrieb Christian Ebner:
> 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.

It sounds like you checked out surrounding code more closely, I did not,
so it's probably better to go with your idea for now.




More information about the pbs-devel mailing list