From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/4] api: merge garbage-collection-status and -job-status
Date: Mon, 22 Apr 2024 13:38:32 +0200 [thread overview]
Message-ID: <20240422113834.842169-3-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20240422113834.842169-1-f.gruenbichler@proxmox.com>
the latter was newly introduced, and they both return basically the same
information now. the new extended (job) status struct is a strict superset of
the old status struct, so this is not a breaking change API wise.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/api2/admin/datastore.rs | 34 +---------------------------------
src/api2/admin/gc.rs | 8 +++-----
2 files changed, 4 insertions(+), 38 deletions(-)
diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index da2b545a..e7a823b5 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1212,34 +1212,6 @@ pub fn start_garbage_collection(
Ok(json!(upid_str))
}
-#[api(
- input: {
- properties: {
- store: {
- schema: DATASTORE_SCHEMA,
- },
- },
- },
- returns: {
- type: GarbageCollectionStatus,
- },
- access: {
- permission: &Permission::Privilege(&["datastore", "{store}"], PRIV_DATASTORE_AUDIT, false),
- },
-)]
-/// Garbage collection status.
-pub fn garbage_collection_status(
- store: String,
- _info: &ApiMethod,
- _rpcenv: &mut dyn RpcEnvironment,
-) -> Result<GarbageCollectionStatus, Error> {
- let datastore = DataStore::lookup_datastore(&store, Some(Operation::Read))?;
-
- let status = datastore.last_gc_status();
-
- Ok(status)
-}
-
#[api(
input: {
properties: {
@@ -1256,7 +1228,7 @@ pub fn garbage_collection_status(
},
)]
/// Garbage collection status.
-pub fn garbage_collection_job_status(
+pub fn garbage_collection_status(
store: String,
_info: &ApiMethod,
_rpcenv: &mut dyn RpcEnvironment,
@@ -2406,10 +2378,6 @@ const DATASTORE_INFO_SUBDIRS: SubdirMap = &[
.get(&API_METHOD_GARBAGE_COLLECTION_STATUS)
.post(&API_METHOD_START_GARBAGE_COLLECTION),
),
- (
- "gc-job-status",
- &Router::new().get(&API_METHOD_GARBAGE_COLLECTION_JOB_STATUS),
- ),
(
"group-notes",
&Router::new()
diff --git a/src/api2/admin/gc.rs b/src/api2/admin/gc.rs
index 7535f369..bca06897 100644
--- a/src/api2/admin/gc.rs
+++ b/src/api2/admin/gc.rs
@@ -8,7 +8,7 @@ use pbs_api_types::DATASTORE_SCHEMA;
use serde_json::Value;
-use crate::api2::admin::datastore::{garbage_collection_job_status, get_datastore_list};
+use crate::api2::admin::datastore::{garbage_collection_status, get_datastore_list};
#[api(
input: {
@@ -37,13 +37,11 @@ pub fn list_all_gc_jobs(
rpcenv: &mut dyn RpcEnvironment,
) -> Result<Vec<GarbageCollectionJobStatus>, Error> {
let gc_info = match store {
- Some(store) => {
- garbage_collection_job_status(store, _info, rpcenv).map(|info| vec![info])?
- }
+ Some(store) => garbage_collection_status(store, _info, rpcenv).map(|info| vec![info])?,
None => get_datastore_list(Value::Null, _info, rpcenv)?
.into_iter()
.map(|store_list_item| store_list_item.store)
- .filter_map(|store| garbage_collection_job_status(store, _info, rpcenv).ok())
+ .filter_map(|store| garbage_collection_status(store, _info, rpcenv).ok())
.collect::<Vec<_>>(),
};
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-04-22 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 11:05 [pbs-devel] [PATCH proxmox-backup 0/3] follow ups for gc job status series Dominik Csapak
2024-04-22 11:05 ` [pbs-devel] [PATCH proxmox-backup 1/3] ui: gc view: use beforedestroy for stopping the store Dominik Csapak
2024-04-22 11:05 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: prune/gc view: improve sizing & scrolling behaviour Dominik Csapak
2024-04-22 11:05 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: gc view: remove unnecessary widths in columns Dominik Csapak
2024-04-22 11:38 ` [pbs-devel] [PATCH proxmox-backup 0/4] more follow-ups Fabian Grünbichler
2024-04-22 11:38 ` [pbs-devel] [PATCH proxmox-backup 1/4] GC: flatten existing status into job status Fabian Grünbichler
2024-04-22 11:38 ` Fabian Grünbichler [this message]
2024-04-22 11:38 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: don't re-calculate GC duration Fabian Grünbichler
2024-04-22 11:38 ` [pbs-devel] [PATCH proxmox-backup 4/4] GC status: reduce code duplication Fabian Grünbichler
2024-04-23 12:36 ` [pbs-devel] applied: [PATCH proxmox-backup 0/3] follow ups for gc job status series Fabian Grünbichler
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=20240422113834.842169-3-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-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