]> git.proxmox.com Git - proxmox-backup.git/commitdiff
version: remove named features
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 21 Nov 2024 09:13:38 +0000 (10:13 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 21 Nov 2024 10:53:49 +0000 (11:53 +0100)
and use version comparison for the push code that previously used it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
pbs-api-types/src/version.rs
src/api2/version.rs
src/server/push.rs

index 7a4c6cb74086402446af04731e15c0b2105fdbbb..80f87e37236966a93c67443fbe2e540c10bbd1dd 100644 (file)
@@ -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<String>,
 }
 
 pub type ApiVersionMajor = u64;
@@ -48,7 +38,6 @@ pub struct ApiVersion {
     pub minor: ApiVersionMinor,
     pub release: ApiVersionRelease,
     pub repoid: String,
-    pub features: Vec<String>,
 }
 
 impl TryFrom<ApiVersionInfo> for ApiVersion {
@@ -76,13 +65,6 @@ impl TryFrom<ApiVersionInfo> 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)
-    }
-}
index da2cb74b4c0c99ff1e8167795190170d3d9be97f..4d104f2d64aa203cf2cf924141c131acc6f3636a 100644 (file)
@@ -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(),
     })
 }
 
index 4ccaa379cbb0bcb3268f9f95c5ab33704c80fb0e..666900e865696377e78bed97ae62c6bfe962fc0e 100644 (file)
@@ -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,