all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox v2 4/4] s3-client: return list of errors when deleting by prefix
Date: Wed,  4 Mar 2026 14:59:20 +0100	[thread overview]
Message-ID: <20260304135922.717714-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260304135922.717714-1-c.ebner@proxmox.com>

Previously only a boolean flag indicating whether there was an error
or not was returned. Now return a list of errors which occurred
when performing object deletion. This allows to better log and
inspect error causes.

Further, since this is now part of the public facing api, expose the
DeleteObjectError type to allow for error handling on the call side.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- not present in previous version

 proxmox-s3-client/src/client.rs | 18 +++++++++---------
 proxmox-s3-client/src/lib.rs    |  2 ++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 5eea4dd3..435b3992 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -666,12 +666,12 @@ impl S3Client {
 
     /// Delete objects by given key prefix.
     /// Requires at least 2 api calls.
-    pub async fn delete_objects_by_prefix(&self, prefix: &S3PathPrefix) -> Result<bool, Error> {
+    pub async fn delete_objects_by_prefix(&self, prefix: &S3PathPrefix) -> Result<Vec<DeleteObjectError>, Error> {
         // S3 API does not provide a convenient way to delete objects by key prefix.
         // List all objects with given group prefix and delete all objects found, so this
         // requires at least 2 API calls.
         let mut next_continuation_token: Option<String> = None;
-        let mut delete_errors = false;
+        let mut delete_errors = Vec::new();
         loop {
             let list_objects_result = self
                 .list_objects_v2(prefix, next_continuation_token.as_deref())
@@ -684,8 +684,8 @@ impl S3Client {
                 .collect();
 
             let response = self.delete_objects(&objects_to_delete).await?;
-            if response.error.is_some() {
-                delete_errors = true;
+            if let Some(mut errors) = response.error {
+                delete_errors.append(&mut errors);
             }
 
             if list_objects_result.is_truncated {
@@ -713,12 +713,12 @@ impl S3Client {
         prefix: &S3PathPrefix,
         suffix: &str,
         excldue_from_parent: &[&str],
-    ) -> Result<bool, Error> {
+    ) -> Result<Vec<DeleteObjectError>, Error> {
         // S3 API does not provide a convenient way to delete objects by key prefix.
         // List all objects with given group prefix and delete all objects found, so this
         // requires at least 2 API calls.
         let mut next_continuation_token: Option<String> = None;
-        let mut delete_errors = false;
+        let mut delete_errors = Vec::new();
         let mut prefix_filters = Vec::new();
         let mut list_objects = Vec::new();
         loop {
@@ -772,9 +772,9 @@ impl S3Client {
             .collect();
 
         for objects in objects_to_delete.chunks(1000) {
-            let result = self.delete_objects(objects).await?;
-            if result.error.is_some() {
-                delete_errors = true;
+            let response = self.delete_objects(objects).await?;
+            if let Some(mut errors) = response.error {
+                delete_errors.append(&mut errors);
             }
         }
 
diff --git a/proxmox-s3-client/src/lib.rs b/proxmox-s3-client/src/lib.rs
index d02fd0dc..5c8c4b08 100644
--- a/proxmox-s3-client/src/lib.rs
+++ b/proxmox-s3-client/src/lib.rs
@@ -33,3 +33,5 @@ mod object_key;
 pub use object_key::S3ObjectKey;
 #[cfg(feature = "impl")]
 mod response_reader;
+#[cfg(feature = "impl")]
+pub use response_reader::DeleteObjectError;
-- 
2.47.3





  parent reply	other threads:[~2026-03-04 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 13:59 [PATCH proxmox{,-backup} v2 0/6] fix #7078: Add quirk for providers not supporting deleteObjects Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 1/4] s3-client: parse and return headers for delete object response Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 2/4] s3-client: return dedicated error type " Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 3/4] s3-client: extend provider quirks by delete objects via delete object Christian Ebner
2026-03-04 13:59 ` Christian Ebner [this message]
2026-03-04 13:59 ` [PATCH proxmox-backup v2 1/2] datastore: s3: modify delete objects api and log exposed errors Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox-backup v2 2/2] fix #7078: ui: exponse DeleteObjects via DeleteObject provider quirk Christian Ebner

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=20260304135922.717714-5-c.ebner@proxmox.com \
    --to=c.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal