From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 69B401FF14C for ; Fri, 15 May 2026 17:21:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EFC7E126DE; Fri, 15 May 2026 17:21:51 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [PATCH datacenter-manager v3 04/12] subscription: api: add key pool and node status endpoints From: Wolfgang Bumiller To: Thomas Lamprecht In-Reply-To: <20260515074623.766766-5-t.lamprecht@proxmox.com> References: <20260515074623.766766-1-t.lamprecht@proxmox.com> <20260515074623.766766-5-t.lamprecht@proxmox.com> Date: Fri, 15 May 2026 17:21:04 +0200 Message-Id: <177885846422.344453.220557680274603474.b4-review@b4> X-Mailer: b4 0.15.2 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778858466341 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.087 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EDSIHFEW44ALIKOJEZQWRMOECX753Q2R X-Message-ID-Hash: EDSIHFEW44ALIKOJEZQWRMOECX753Q2R X-MailFrom: w.bumiller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pdm-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 15 May 2026 09:43:14 +0200, Thomas Lamprecht wrote: > diff --git a/server/src/api/subscriptions/mod.rs b/server/src/api/subscriptions/mod.rs > new file mode 100644 > index 0000000..aa3146e > --- /dev/null > +++ b/server/src/api/subscriptions/mod.rs > @@ -0,0 +1,1542 @@ > [ ... skip 210 lines ... ] > + // loop on the first collision. The all-or-nothing contract holds because save_config > + // only runs after the loop completes, so a bail on entry N leaves the on-disk pool > + // untouched even if entries 1..N already landed in the in-memory `config`. > + for entry in entries { > + let key = entry.key.clone(); > + if let Some(existing) = config.insert(key.clone(), entry) { ^ This clone can be skipped, since you use the key from `existing` for the error message. > [ ... skip 34 lines ... ] > + let (config, digest) = pdm_config::subscriptions::config()?; > + rpcenv["digest"] = digest.to_hex().into(); > + let mut entry = config > + .get(&key) > + .cloned() > + .ok_or_else(|| http_err!(NOT_FOUND, "key '{key}' not found in pool"))?; We could put the `http_err!()` call into a reusable closure so we also only have a single instance of the message text, to make it more difficult for future patches to accidentally only change 1 of them. --