public inbox for pdm-devel@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 v4 20/21] pdm-config: subscriptions: drop unused accessor functions
Date: Thu,  3 Sep 2026 08:50:15 +0200	[thread overview]
Message-ID: <20260903065016.31726-21-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260903065016.31726-1-l.wagner@proxmox.com>

Now that the subscription API handlers reach the config through
PdmApplication instead, the free functions built on top of the global
INSTANCE static are unused. Drop them along with the init() call that
used to populate it.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 lib/pdm-config/src/subscriptions.rs | 39 -----------------------------
 server/src/context/mod.rs           |  1 -
 2 files changed, 40 deletions(-)

diff --git a/lib/pdm-config/src/subscriptions.rs b/lib/pdm-config/src/subscriptions.rs
index 5be88a13..c4b99d25 100644
--- a/lib/pdm-config/src/subscriptions.rs
+++ b/lib/pdm-config/src/subscriptions.rs
@@ -7,8 +7,6 @@
 //! entries, which is intended as future proofing for a more automated (shop) import without having
 //! to adapt the data layer.
 
-use std::sync::OnceLock;
-
 use anyhow::Error;
 
 use proxmox_config_digest::ConfigDigest;
@@ -25,37 +23,6 @@ pub const SUBSCRIPTIONS_CFG_FILENAME: &str = configdir!("/subscriptions/keys.cfg
 const SUBSCRIPTIONS_SHADOW_FILENAME: &str = configdir!("/subscriptions/keys.shadow");
 pub const SUBSCRIPTIONS_CFG_LOCKFILE: &str = configdir!("/subscriptions/.keys.lock");
 
-static INSTANCE: OnceLock<Box<dyn SubscriptionKeyConfig + Send + Sync>> = OnceLock::new();
-
-fn instance() -> &'static (dyn SubscriptionKeyConfig + Send + Sync) {
-    INSTANCE
-        .get()
-        .expect("subscription key config not initialized")
-        .as_ref()
-}
-
-pub fn lock_config() -> Result<ApiLockGuard, Error> {
-    instance().lock()
-}
-
-pub fn config() -> Result<(SectionConfigData<SubscriptionKeyEntry>, ConfigDigest), Error> {
-    instance().read()
-}
-
-pub fn shadow_config() -> Result<SectionConfigData<SubscriptionKeyShadow>, Error> {
-    instance().read_shadow()
-}
-
-pub fn save_config(
-    config: &SectionConfigData<SubscriptionKeyEntry>,
-) -> Result<ConfigDigest, Error> {
-    instance().write(config)
-}
-
-pub fn save_shadow(shadow: &SectionConfigData<SubscriptionKeyShadow>) -> Result<(), Error> {
-    instance().write_shadow(shadow)
-}
-
 pub trait SubscriptionKeyConfig {
     fn read(&self) -> Result<(SectionConfigData<SubscriptionKeyEntry>, ConfigDigest), Error>;
     fn read_shadow(&self) -> Result<SectionConfigData<SubscriptionKeyShadow>, Error>;
@@ -110,9 +77,3 @@ impl SubscriptionKeyConfig for DefaultSubscriptionKeyConfig {
         replace_secret_config(SUBSCRIPTIONS_SHADOW_FILENAME, raw.as_bytes())
     }
 }
-
-pub fn init(instance: Box<dyn SubscriptionKeyConfig + Send + Sync>) {
-    if INSTANCE.set(instance).is_err() {
-        panic!("subscription key config instance already set");
-    }
-}
diff --git a/server/src/context/mod.rs b/server/src/context/mod.rs
index 082ab8de..95238030 100644
--- a/server/src/context/mod.rs
+++ b/server/src/context/mod.rs
@@ -34,7 +34,6 @@ pub fn init() -> Result<PdmApplication, Error> {
     // anyway, and the implementation is stateless, so having this second
     // instance is not an issue *currently*.
     pdm_config::remotes::init(factory.make_remote_config()?);
-    pdm_config::subscriptions::init(factory.make_subscription_key_config()?);
 
     Ok(app)
 }
-- 
2.47.3





  parent reply	other threads:[~2026-09-03  6:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  6:49 [PATCH datacenter-manager/proxmox v4 00/21] inject application context via API macro for easier integration testing Lukas Wagner
2026-09-03  6:49 ` [PATCH proxmox v4 01/21] router: introduce shared state Lukas Wagner
2026-09-03  6:49 ` [PATCH proxmox v4 02/21] rest-server: allow to inject " Lukas Wagner
2026-09-03  6:49 ` [PATCH proxmox v4 03/21] api-macro: support shared state extraction type Lukas Wagner
2026-09-03  8:25   ` Lukas Wagner
2026-09-03  6:49 ` [PATCH proxmox v4 04/21] product-config: add ProductConfig type Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 05/21] context: promote context to a dir-style module Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 06/21] pdm-config: remotes: rename trait methods to read/write/lock Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 07/21] pdm-config: subscriptions: " Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 08/21] remote iterator: pass remote config reader explicitly Lukas Wagner
2026-09-03  9:33   ` Michael Köppl
2026-09-03  9:41     ` Michael Köppl
2026-09-03  6:50 ` [PATCH datacenter-manager v4 09/21] context: introduce a ContextFactory to build application context Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 10/21] context: establish PdmApplication object Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 11/21] context: register PdmApplication in router Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 12/21] connection: use client factory from PdmApplication handle Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 13/21] parallel fetcher: pass arguments to closure in a single type Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 14/21] server: migrate existing ParallelFetcher users to use PdmApplication Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 15/21] tests: add helpers for building API-handler-level integration tests Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 16/21] tests: add example tests for SDN API routes Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 17/21] api-cache: add wrapper type Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 18/21] context: provide api-cache on the app object Lukas Wagner
2026-09-03  6:50 ` [PATCH datacenter-manager v4 19/21] api: subscriptions: use PdmApplication instead of globals Lukas Wagner
2026-09-03  6:50 ` Lukas Wagner [this message]
2026-09-03  6:50 ` [PATCH datacenter-manager v4 21/21] tests: add example tests for remote subscription management Lukas Wagner
2026-09-03 11:17 ` superseded: [PATCH datacenter-manager/proxmox v4 00/21] inject application context via API macro for easier integration testing 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=20260903065016.31726-21-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 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