all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 1/6] pdm-api-types: add NativeUpid::node() convenience getter
Date: Fri, 29 May 2026 15:39:46 +0200	[thread overview]
Message-ID: <20260529133951.326103-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260529133951.326103-1-l.wagner@proxmox.com>

Some callers need to get the 'node' property of a UPID, but handle both,
PBS and PVE equally, making a distinction at the call site inconvenient.
Providing a 'node' getter in NativeUpid simplifies callers a little.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 lib/pdm-api-types/src/remote_upid.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/pdm-api-types/src/remote_upid.rs b/lib/pdm-api-types/src/remote_upid.rs
index 1e90bef4..194e4a18 100644
--- a/lib/pdm-api-types/src/remote_upid.rs
+++ b/lib/pdm-api-types/src/remote_upid.rs
@@ -26,6 +26,16 @@ pub enum NativeUpid {
     PbsUpid(pbs_api_types::UPID),
 }
 
+impl NativeUpid {
+    /// Convenience getter to query the 'node' property of a task.
+    pub fn node(&self) -> &str {
+        match self {
+            NativeUpid::PveUpid(upid) => upid.node.as_str(),
+            NativeUpid::PbsUpid(upid) => upid.node.as_str(),
+        }
+    }
+}
+
 impl RemoteUpid {
     /// Create a new remote UPID.
     pub fn new(remote: String, remote_type: RemoteType, upid: String) -> Self {
-- 
2.47.3





  reply	other threads:[~2026-05-29 13:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 13:39 [PATCH datacenter-manager 0/6] fix #7639: task cache: consider running tasks when updating the cutoff timestamp Lukas Wagner
2026-05-29 13:39 ` Lukas Wagner [this message]
2026-05-29 13:39 ` [PATCH datacenter-manager 2/6] task cache: tests: allow to provide an explicit end time in 'task' helper Lukas Wagner
2026-05-29 13:39 ` [PATCH datacenter-manager 3/6] task cache: tests: add get_cutoff helper Lukas Wagner
2026-05-29 13:39 ` [PATCH datacenter-manager 4/6] task cache: tests: add 'make_cache' convenience helper Lukas Wagner
2026-05-29 13:39 ` [PATCH datacenter-manager 5/6] fix #7639: task cache: consider running tasks when updating the cutoff timestamp Lukas Wagner
2026-05-29 13:39 ` [PATCH datacenter-manager 6/6] task cache: poll known active tasks every 30 seconds Lukas Wagner

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=20260529133951.326103-2-l.wagner@proxmox.com \
    --to=l.wagner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal