public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: Proxmox Datacenter Manager development discussion
	<pdm-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pdm-devel] [PATCH datacenter-manager] server: fake remotes: adapt to changed ClientFactory trait
Date: Tue, 13 May 2025 15:25:37 +0200	[thread overview]
Message-ID: <0b0cdabb-341f-4d81-b1c3-2570c81a30f3@proxmox.com> (raw)
In-Reply-To: <20250513130450.2702542-1-d.csapak@proxmox.com>

For the record, I already sent a patch for this in a previous patch series.

https://lore.proxmox.com/pdm-devel/20250418083210.74982-6-l.wagner@proxmox.com/T/#u

On  2025-05-13 15:04, Dominik Csapak wrote:
> that trait changed some types, so we have to adapt here, namely
> * use the crate::connection::PveClient type instead of typing it manually
> * use Arc instead of Box
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  server/src/test_support/fake_remote.rs | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/server/src/test_support/fake_remote.rs b/server/src/test_support/fake_remote.rs
> index 0161d8e..c52bc32 100644
> --- a/server/src/test_support/fake_remote.rs
> +++ b/server/src/test_support/fake_remote.rs
> @@ -1,4 +1,4 @@
> -use std::{collections::HashMap, time::Duration};
> +use std::{collections::HashMap, sync::Arc, time::Duration};
>  
>  use anyhow::{bail, Error};
>  use pdm_api_types::{remotes::Remote, Authid, ConfigDigest};
> @@ -6,13 +6,16 @@ use pdm_config::remotes::RemoteConfig;
>  use proxmox_product_config::ApiLockGuard;
>  use proxmox_section_config::typed::SectionConfigData;
>  use pve_api_types::{
> -    client::PveClient, ClusterMetrics, ClusterMetricsData, ClusterNodeIndexResponse,
> -    ClusterNodeIndexResponseStatus, ClusterResource, ClusterResourceKind, ClusterResourceType,
> -    ListTasks, ListTasksResponse, PveUpid, StorageContent,
> +    ClusterMetrics, ClusterMetricsData, ClusterNodeIndexResponse, ClusterNodeIndexResponseStatus,
> +    ClusterResource, ClusterResourceKind, ClusterResourceType, ListTasks, ListTasksResponse,
> +    PveUpid, StorageContent,
>  };
>  use serde::Deserialize;
>  
> -use crate::{connection::ClientFactory, pbs_client::PbsClient};
> +use crate::{
> +    connection::{ClientFactory, PveClient},
> +    pbs_client::PbsClient,
> +};
>  
>  #[derive(Deserialize, Clone)]
>  #[serde(rename_all = "kebab-case")]
> @@ -74,8 +77,8 @@ impl FakeRemoteConfig {
>  
>  #[async_trait::async_trait]
>  impl ClientFactory for FakeClientFactory {
> -    fn make_pve_client(&self, _remote: &Remote) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
> -        Ok(Box::new(FakePveClient {
> +    fn make_pve_client(&self, _remote: &Remote) -> Result<Arc<PveClient>, Error> {
> +        Ok(Arc::new(FakePveClient {
>              nr_of_vms: self.config.vms_per_pve_remote,
>              nr_of_cts: self.config.cts_per_pve_remote,
>              nr_of_nodes: self.config.nodes_per_pve_remote,
> @@ -88,7 +91,7 @@ impl ClientFactory for FakeClientFactory {
>          &self,
>          _remote: &Remote,
>          _target_endpoint: Option<&str>,
> -    ) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
> +    ) -> Result<Arc<PveClient>, Error> {
>          bail!("not implemented")
>      }
>  
> @@ -96,10 +99,7 @@ impl ClientFactory for FakeClientFactory {
>          bail!("not implemented")
>      }
>  
> -    async fn make_pve_client_and_login(
> -        &self,
> -        _remote: &Remote,
> -    ) -> Result<Box<dyn PveClient + Send + Sync>, Error> {
> +    async fn make_pve_client_and_login(&self, _remote: &Remote) -> Result<Arc<PveClient>, Error> {
>          bail!("not implemented")
>      }
>  
> @@ -118,7 +118,7 @@ struct FakePveClient {
>  }
>  
>  #[async_trait::async_trait]
> -impl PveClient for FakePveClient {
> +impl pve_api_types::client::PveClient for FakePveClient {
>      async fn cluster_resources(
>          &self,
>          _ty: Option<ClusterResourceKind>,

-- 
- Lukas



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-05-13 13:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 13:04 Dominik Csapak
2025-05-13 13:25 ` Lukas Wagner [this message]
2025-05-14  7:30   ` Dominik Csapak
2025-05-14  7:49     ` Lukas Wagner
2025-05-14  8:02       ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b0cdabb-341f-4d81-b1c3-2570c81a30f3@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal