public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>,
	"Proxmox Backup Server development discussion"
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox 2/3] s3-client: parse and return headers for delete object response
Date: Tue, 24 Feb 2026 13:03:11 +0100	[thread overview]
Message-ID: <7d7af590-7ce1-407f-9b7e-563a1a5c38cd@proxmox.com> (raw)
In-Reply-To: <1771933070.i0upna84z7.astroid@yuna.none>

On 2/24/26 12:44 PM, Fabian Grünbichler wrote:
> On January 27, 2026 1:27 pm, Christian Ebner wrote:
>> Mimic the response elements from the list objects parsing in the
>> delete object response.
>>
>> In preparation for being able to perform delete objects via
>> individual delete object api calls, if the respective provider quirk
>> is set in the client options.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>>   proxmox-s3-client/src/client.rs          |  9 +++++----
>>   proxmox-s3-client/src/response_reader.rs | 21 +++++++++++++++++++--
>>   2 files changed, 24 insertions(+), 6 deletions(-)
>>
>> diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
>> index 83176b39..3d0af5d6 100644
>> --- a/proxmox-s3-client/src/client.rs
>> +++ b/proxmox-s3-client/src/client.rs
>> @@ -29,8 +29,9 @@ use crate::aws_sign_v4::AWS_SIGN_V4_DATETIME_FORMAT;
>>   use crate::aws_sign_v4::{aws_sign_v4_signature, aws_sign_v4_uri_encode};
>>   use crate::object_key::S3ObjectKey;
>>   use crate::response_reader::{
>> -    CopyObjectResponse, DeleteObjectsResponse, GetObjectResponse, HeadObjectResponse,
>> -    ListBucketsResponse, ListObjectsV2Response, PutObjectResponse, ResponseReader,
>> +    CopyObjectResponse, DeleteObjectsResponse, DeletedObject, GetObjectResponse,
>> +    HeadObjectResponse, ListBucketsResponse, ListObjectsV2Response, PutObjectResponse,
>> +    ResponseReader,
>>   };
>>   
>>   /// Default timeout for s3 api requests.
>> @@ -544,7 +545,7 @@ impl S3Client {
>>   
>>       /// Removes an object from a bucket.
>>       /// See reference docs: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html
>> -    pub async fn delete_object(&self, object_key: S3ObjectKey) -> Result<(), Error> {
>> +    pub async fn delete_object(&self, object_key: S3ObjectKey) -> Result<DeletedObject, Error> {
>>           let object_key = object_key.to_full_key(&self.options.common_prefix);
>>           let request = Request::builder()
>>               .method(Method::DELETE)
>> @@ -553,7 +554,7 @@ impl S3Client {
>>   
>>           let response = self.send(request, None).await?;
>>           let response_reader = ResponseReader::new(response);
>> -        response_reader.delete_object_response().await
>> +        response_reader.delete_object_response(object_key).await
>>       }
>>   
>>       /// Delete multiple objects from a bucket using a single HTTP request.
>> diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
>> index 7066c33b..be7c0950 100644
>> --- a/proxmox-s3-client/src/response_reader.rs
>> +++ b/proxmox-s3-client/src/response_reader.rs
>> @@ -361,7 +361,10 @@ impl ResponseReader {
>>       /// Read and parse the delete object response.
>>       ///
>>       /// Returns with error if an unexpected status code is encountered.
>> -    pub(crate) async fn delete_object_response(self) -> Result<(), Error> {
>> +    pub(crate) async fn delete_object_response(
>> +        self,
>> +        key: S3ObjectKey,
>> +    ) -> Result<DeletedObject, Error> {
>>           let (parts, _body) = self.response.into_parts();
>>   
>>           match parts.status {
>> @@ -369,7 +372,21 @@ impl ResponseReader {
>>               status_code => bail!("unexpected status code {status_code}"),
> 
> the changes of this and the following patch itself look fine (albeit
> breaking ;)), but the error handling here seems a bit weird.. especially
> combined with the parts in proxmox-backup?
> 
> could we maybe improve things instead of basically swallowing all
> details and saying "some objects couldn't be deleted"?
> 
> AFAICT `code` in DeleteObjectsResponse is never set as part of this
> series?

Okay, might be hard to encode which objects failed deletion in the error 
message, but that could be logged instead and maybe the number of failed 
object deletes included in the error message, to give some context.

Anyhow, will see to improve this and send a new version, thanks!




  reply	other threads:[~2026-02-24 12:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 12:27 [pbs-devel] [PATCH proxmox{, -backup} 0/4] fix #7078: Add quirk for providers not supporting deleteObjects Christian Ebner
2026-01-27 12:27 ` [pbs-devel] [PATCH proxmox 1/3] s3-client: factor out optional response header parsing Christian Ebner
2026-02-24 11:44   ` partially-applied: " Fabian Grünbichler
2026-01-27 12:27 ` [pbs-devel] [PATCH proxmox 2/3] s3-client: parse and return headers for delete object response Christian Ebner
2026-02-24 11:44   ` Fabian Grünbichler
2026-02-24 12:03     ` Christian Ebner [this message]
2026-01-27 12:27 ` [pbs-devel] [PATCH proxmox 3/3] s3-client: extend provider quirks by delete objects via delete object Christian Ebner
2026-01-27 12:27 ` [pbs-devel] [PATCH proxmox-backup 1/1] 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=7d7af590-7ce1-407f-9b7e-563a1a5c38cd@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal