[pbs-devel] [PATCH v4 proxmox 13/31] api: admin: avoid duplicate name for list sync jobs api method

Christian Ebner c.ebner at proxmox.com
Thu Oct 17 15:26:58 CEST 2024


`list_sync_jobs` exists as api method in `api2::admin::sync` and
`api2::config::sync`.

Rename the admin api endpoint method to `list_config_sync_jobs` in
order to reduce possible confusion when searching/reviewing.

No functional change intended.

Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 3:
- not present in previous version

 src/api2/admin/sync.rs               | 6 +++---
 src/api2/config/datastore.rs         | 6 ++++--
 src/api2/config/notifications/mod.rs | 4 ++--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/api2/admin/sync.rs b/src/api2/admin/sync.rs
index c6b309859..1afe9fec2 100644
--- a/src/api2/admin/sync.rs
+++ b/src/api2/admin/sync.rs
@@ -45,8 +45,8 @@ use crate::{
         permission: &Permission::Anybody,
     },
 )]
-/// List all sync jobs
-pub fn list_sync_jobs(
+/// List all configured sync jobs
+pub fn list_config_sync_jobs(
     store: Option<String>,
     sync_direction: Option<SyncDirection>,
     _param: Value,
@@ -141,5 +141,5 @@ const SYNC_INFO_ROUTER: Router = Router::new()
     .subdirs(SYNC_INFO_SUBDIRS);
 
 pub const ROUTER: Router = Router::new()
-    .get(&API_METHOD_LIST_SYNC_JOBS)
+    .get(&API_METHOD_LIST_CONFIG_SYNC_JOBS)
     .match_all("id", &SYNC_INFO_ROUTER);
diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index e2d876555..eb5a84ca0 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -21,7 +21,7 @@ use pbs_config::BackupLockGuard;
 use pbs_datastore::chunk_store::ChunkStore;
 
 use crate::api2::admin::{
-    prune::list_prune_jobs, sync::list_sync_jobs, verify::list_verification_jobs,
+    prune::list_prune_jobs, sync::list_config_sync_jobs, verify::list_verification_jobs,
 };
 use crate::api2::config::prune::{delete_prune_job, do_create_prune_job};
 use crate::api2::config::sync::delete_sync_job;
@@ -500,7 +500,9 @@ pub async fn delete_datastore(
             delete_verification_job(job.config.id, None, rpcenv)?
         }
         for direction in [SyncDirection::Pull, SyncDirection::Push] {
-            for job in list_sync_jobs(Some(name.clone()), Some(direction), Value::Null, rpcenv)? {
+            for job in
+                list_config_sync_jobs(Some(name.clone()), Some(direction), Value::Null, rpcenv)?
+            {
                 delete_sync_job(job.config.id, Some(direction), None, rpcenv)?
             }
         }
diff --git a/src/api2/config/notifications/mod.rs b/src/api2/config/notifications/mod.rs
index 31c4851c1..f156c8cfd 100644
--- a/src/api2/config/notifications/mod.rs
+++ b/src/api2/config/notifications/mod.rs
@@ -12,7 +12,7 @@ use crate::api2::admin::datastore::get_datastore_list;
 use pbs_api_types::{SyncDirection, PRIV_SYS_AUDIT};
 
 use crate::api2::admin::prune::list_prune_jobs;
-use crate::api2::admin::sync::list_sync_jobs;
+use crate::api2::admin::sync::list_config_sync_jobs;
 use crate::api2::admin::verify::list_verification_jobs;
 use crate::api2::config::media_pool::list_pools;
 use crate::api2::tape::backup::list_tape_backup_jobs;
@@ -155,7 +155,7 @@ pub fn get_values(
     }
 
     for direction in [SyncDirection::Pull, SyncDirection::Push] {
-        let sync_jobs = list_sync_jobs(None, Some(direction), param.clone(), rpcenv)?;
+        let sync_jobs = list_config_sync_jobs(None, Some(direction), param.clone(), rpcenv)?;
         for job in sync_jobs {
             values.push(MatchableValue {
                 field: "job-id".into(),
-- 
2.39.5





More information about the pbs-devel mailing list