From: Fabian Grünbichler Date: Thu, 21 Nov 2024 09:13:38 +0000 (+0100) Subject: version: remove named features X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a5350595fc0bd65d908e242d54bf11cfa1441b7d;p=proxmox-backup.git version: remove named features and use version comparison for the push code that previously used it. Signed-off-by: Fabian Grünbichler --- diff --git a/pbs-api-types/src/version.rs b/pbs-api-types/src/version.rs index 7a4c6cb7..80f87e37 100644 --- a/pbs-api-types/src/version.rs +++ b/pbs-api-types/src/version.rs @@ -20,14 +20,6 @@ use proxmox_schema::api; description: "Version repository id", type: String, }, - "features": { - description: "List of supported features", - type: Array, - items: { - type: String, - description: "Feature id", - }, - }, } )] #[derive(serde::Deserialize, serde::Serialize)] @@ -35,8 +27,6 @@ pub struct ApiVersionInfo { pub version: String, pub release: String, pub repoid: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub features: Vec, } pub type ApiVersionMajor = u64; @@ -48,7 +38,6 @@ pub struct ApiVersion { pub minor: ApiVersionMinor, pub release: ApiVersionRelease, pub repoid: String, - pub features: Vec, } impl TryFrom for ApiVersion { @@ -76,13 +65,6 @@ impl TryFrom for ApiVersion { minor, release, repoid: value.repoid.clone(), - features: value.features.clone(), }) } } - -impl ApiVersion { - pub fn supports_feature(&self, feature: &str) -> bool { - self.features.iter().any(|f| f == feature) - } -} diff --git a/src/api2/version.rs b/src/api2/version.rs index da2cb74b..4d104f2d 100644 --- a/src/api2/version.rs +++ b/src/api2/version.rs @@ -8,8 +8,6 @@ use proxmox_schema::api; use pbs_api_types::ApiVersionInfo; -const FEATURES: &[&str] = &["prune-delete-stats"]; - #[api( returns: { type: ApiVersionInfo, @@ -28,7 +26,6 @@ fn version( version: pbs_buildcfg::PROXMOX_PKG_VERSION.to_string(), release: pbs_buildcfg::PROXMOX_PKG_RELEASE.to_string(), repoid: pbs_buildcfg::PROXMOX_PKG_REPOID.to_string(), - features: FEATURES.iter().map(|feature| feature.to_string()).collect(), }) } diff --git a/src/server/push.rs b/src/server/push.rs index 4ccaa379..666900e8 100644 --- a/src/server/push.rs +++ b/src/server/push.rs @@ -121,13 +121,15 @@ impl PushParameters { let data = result["data"].take(); let version_info: ApiVersionInfo = serde_json::from_value(data)?; let api_version = ApiVersion::try_from(version_info)?; - let supports_prune_delete_stats = api_version.supports_feature("prune-delete-stats"); // 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) { 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 >= 2 && api_version.release >= 11); + let target = PushTarget { remote, repo,