5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-03 01:18:02 +03:00

sync: push: use direct api version comparison in compatibility checks

Use the trait implementations of `ApiVersion` to perform operator
based version comparisons. This makes the comparison more readable
and reduces the risk for errors.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2024-11-28 17:07:21 +01:00 committed by Thomas Lamprecht
parent 00254d60e3
commit 0083e7ac05

View File

@ -127,13 +127,11 @@ impl PushParameters {
let api_version = ApiVersion::try_from(version_info)?;
// push assumes namespace support on the remote side, fail early if missing
if api_version.major < 2 || (api_version.major == 2 && api_version.minor < 2) {
if api_version < ApiVersion::new(2, 2, 0) {
bail!("Unsupported remote api version, minimum v2.2 required");
}
let supports_prune_delete_stats = api_version.major > 3
|| (api_version.major == 3 && api_version.minor >= 3)
|| (api_version.major == 3 && api_version.minor == 2 && api_version.release >= 11);
let supports_prune_delete_stats = api_version >= ApiVersion::new(3, 2, 11);
let target = PushTarget {
remote,