From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D30AB1FF14C for ; Fri, 15 May 2026 10:29:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AD488FDCD; Fri, 15 May 2026 10:29:01 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager v2 0/4] add generic, per-remote (and global) cache for remote API responses Date: Fri, 15 May 2026 10:28:51 +0200 Message-ID: <20260515082855.85698-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778833730404 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 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: 4GAGES2L3H5HSA4QWMN7K65M2357AM2Z X-Message-ID-Hash: 4GAGES2L3H5HSA4QWMN7K65M2357AM2Z X-MailFrom: l.wagner@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 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: The main intention is to avoid a sprawl of different caching approaches by establishing a simple, easy to use cache implementation that can be used to persistently cache API responses from remotes (and derived aggregations). The `namespaced_cache` module is pretty generic and can be moved to proxmox.git (maybe in proxmox-shared-cache) once it has sufficiently stabilized. Changes since the RFC: - change storage location to /run/proxmox-datacenter-manager/api-cache - change name of pdm_cache to api_cache - use freestanding functions in api_cache - add async interface - minor code style improments - improve test coverage and documentation - add basic sanity checks for namespaces and keys (e.g. prohibiting ../) - add cleanup code for the old remote-updates cachefile Thanks to Dominik C. and Wolfgang for their reviews of the RFC, highly appreciated! Changes since v1: - The only changes happened in the last two patches: - Improved behavior in case the cache entry could not be read, mostly to ensure a self-healing behavior - Slightly restructured code to avoid some clone calls - When requesting the list of updates for a single remote, update the global summary cache asynchronously proxmox-datacenter-manager: Lukas Wagner (4): add persistent, generic, namespaced key-value cache implementation add api_cache as a specialized wrapper around the namespaced cache api: resources: subscriptions: switch over to api_cache remote-updates: switch over to new api_cache Cargo.toml | 1 + debian/control | 1 + server/Cargo.toml | 4 + server/src/api/pve/mod.rs | 4 +- server/src/api/remotes/updates.rs | 6 +- server/src/api/resources.rs | 84 +- server/src/api_cache.rs | 126 +++ .../bin/proxmox-datacenter-privileged-api.rs | 9 +- server/src/lib.rs | 2 + server/src/namespaced_cache.rs | 742 ++++++++++++++++++ server/src/remote_updates.rs | 120 +-- 11 files changed, 994 insertions(+), 105 deletions(-) create mode 100644 server/src/api_cache.rs create mode 100644 server/src/namespaced_cache.rs Summary over all repositories: 11 files changed, 994 insertions(+), 105 deletions(-) -- Generated by murpp 0.12.0