[pdm-devel] [PATCH proxmox{, -datacenter-manager} v2 0/4] Remove direct access to SectionConfigData<T> sections
Gabriel Goller
g.goller at proxmox.com
Wed Apr 23 12:20:41 CEST 2025
This patch series removes direct access to SectionConfigData<T>. Previously,
one could directly access and add sections by using DerefMut and the public
`sections` HashMap property. This created a significant risk of not updating
the `order` Vector, which maintains the section sequence to ensure consistent
read and write ordering.
To address this issue, this patch removes the DerefMut implementation and makes
both `sections` and `order` private. Read access remains available through the
Deref implementation for the `sections` HashMap, while write access is now
provided through newly introduced helper methods: `insert`, `remove`, and
`get_mut`.
This is a breaking change that affects multiple `SectionConfigData<T>` usages.
Since SectionConfigData<T> is primarily used in the proxmox-datacenter-manager,
all usages there have been updated accordingly.
A follow-up patch series is in preparation that will convert untyped
SectionConfigData to typed SectionConfigData<T>, which provides better
usability and eliminates the need for frequent serialization and
deserialization operations.
Changelog:
v1, thanks @Wobu:
* move write_config generic into `where` clause (cargo fmt)
* convert `if let` to `match` in macros (cargo fmt)
* use Vec::position and Vec::remove instead of Vec::retain in remove
proxmox:
Gabriel Goller (3):
section-config: make write_section_config parameter more generic
section-config: remove DerefMut and make underlying HashMap private
section-config: add lookup and convert_to_typed_array helpers
proxmox-section-config/Cargo.toml | 3 +
proxmox-section-config/src/typed.rs | 203 ++++++++++++++++++++++++++--
2 files changed, 197 insertions(+), 9 deletions(-)
proxmox-datacenter-manager:
Gabriel Goller (1):
remotes: remove direct access on underlying sections HashMap
server/src/api/resources.rs | 2 +-
server/src/metric_collection/mod.rs | 8 ++++----
server/src/remote_tasks/mod.rs | 6 +++---
server/src/test_support/fake_remote.rs | 9 +++------
4 files changed, 11 insertions(+), 14 deletions(-)
Summary over all repositories:
6 files changed, 208 insertions(+), 23 deletions(-)
--
Generated by git-murpp 0.8.0
More information about the pdm-devel
mailing list