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)]
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;
pub minor: ApiVersionMinor,
pub release: ApiVersionRelease,
pub repoid: String,
- pub features: Vec<String>,
}
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)
- }
-}
use pbs_api_types::ApiVersionInfo;
-const FEATURES: &[&str] = &["prune-delete-stats"];
-
#[api(
returns: {
type: ApiVersionInfo,
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(),
})
}
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,