[pdm-devel] [PATCH datacenter-manager v3 02/19] server: api: pass remote as reference to fetching helpers
Christian Ebner
c.ebner at proxmox.com
Tue Oct 21 13:11:12 CEST 2025
None of the helpers requires ownership of the remote, therefore pass
it as shared reference.
This is in preparation for passing the remote also to the search term
filtering to allow matching the remote type.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Changes since version 2:
- no changes
server/src/api/resources.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index d629c65..21143a8 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -255,7 +255,7 @@ pub(crate) async fn get_resources_impl(
}
let filter = filters.clone();
let handle = tokio::spawn(async move {
- let (mut resources, error) = match get_resources_for_remote(remote, max_age).await {
+ let (mut resources, error) = match get_resources_for_remote(&remote, max_age).await {
Ok(resources) => (resources, None),
Err(error) => {
tracing::debug!("failed to get resources from remote - {error:?}");
@@ -700,7 +700,7 @@ static CACHE: LazyLock<RwLock<HashMap<String, CachedResources>>> =
///
/// If recent enough cached data is available, it is returned
/// instead of calling out to the remote.
-async fn get_resources_for_remote(remote: Remote, max_age: u64) -> Result<Vec<Resource>, Error> {
+async fn get_resources_for_remote(remote: &Remote, max_age: u64) -> Result<Vec<Resource>, Error> {
let remote_name = remote.id.to_owned();
if let Some(cached_resource) = get_cached_resources(&remote_name, max_age) {
Ok(cached_resource.resources)
@@ -756,7 +756,7 @@ fn update_cached_resources(remote: &str, resources: &[Resource], now: i64) {
}
/// Fetch remote resources and map to pdm-native data types.
-async fn fetch_remote_resource(remote: Remote) -> Result<Vec<Resource>, Error> {
+async fn fetch_remote_resource(remote: &Remote) -> Result<Vec<Resource>, Error> {
let mut resources = Vec::new();
let remote_name = remote.id.to_owned();
--
2.47.3
More information about the pdm-devel
mailing list