[pdm-devel] [RFC datacenter-manager 2/3] api types: add new SubscriptionStatistics

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Dec 1 13:40:03 CET 2025


On December 1, 2025 1:36 pm, Dominik Csapak wrote:
> AFAICS this type is only ever used internally and never returned from 
> the api, so IMHO there is no need to use the api macro here
> (or derive (de)serialize)

yes, I originally had this as return type in patch 3, but then switched
to returning a SubscriptionInfo since I figured that's easier to handle
in line with existing code.. so unless we revert back to returning the
counts and delegating the decision how to display that to the client,
this can be an internal type.

> 
> On 12/1/25 12:38 PM, Fabian Grünbichler wrote:
>> this is a different view for the global subscription status - instead of
>> looking at the lowest level per remote, count all nodes.
>> 
>> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
>> ---
>> this clashes with dominik's patches which return these counts in the
>> remote subscription endpoints.. since we only need them for the global
>> PDM-level status decision I think this is cleaner, but this could of
>> course also be re-based on top of the other patches..
>> 
>>   lib/pdm-api-types/src/subscription.rs | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>> 
>> diff --git a/lib/pdm-api-types/src/subscription.rs b/lib/pdm-api-types/src/subscription.rs
>> index 64167cb..d38611e 100644
>> --- a/lib/pdm-api-types/src/subscription.rs
>> +++ b/lib/pdm-api-types/src/subscription.rs
>> @@ -143,3 +143,16 @@ pub struct RemoteSubscriptions {
>>   
>>       pub state: RemoteSubscriptionState,
>>   }
>> +
>> +#[api]
>> +#[derive(Default, Serialize, Deserialize, Clone, PartialEq)]
>> +#[serde(rename_all = "kebab-case")]
>> +/// Lists the subscription level per node for the remote
>> +pub struct SubscriptionStatistics {
>> +    /// Total number of nodes across all remotes
>> +    pub total_nodes: usize,
>> +    /// Total number of active subscriptions across all remotes
>> +    pub active_subscriptions: usize,
>> +    /// Total number of community level subscriptions across all remotes
>> +    pub community: usize,
>> +}
> 
> 




More information about the pdm-devel mailing list