From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 875111FF139 for ; Tue, 24 Feb 2026 12:43:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5A9BB6FE7; Tue, 24 Feb 2026 12:44:42 +0100 (CET) Date: Tue, 24 Feb 2026 12:44:34 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: Re: [pbs-devel] [PATCH proxmox 2/3] s3-client: parse and return headers for delete object response To: Proxmox Backup Server development discussion References: <20260127122712.505774-1-c.ebner@proxmox.com> <20260127122712.505774-3-c.ebner@proxmox.com> In-Reply-To: <20260127122712.505774-3-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1771933070.i0upna84z7.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1771933462455 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VPQ4N44DNAFPEOHPVIA62CI6DIWL24KT X-Message-ID-Hash: VPQ4N44DNAFPEOHPVIA62CI6DIWL24KT X-MailFrom: f.gruenbichler@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On January 27, 2026 1:27 pm, Christian Ebner wrote: > Mimic the response elements from the list objects parsing in the > delete object response. >=20 > 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. >=20 > Signed-off-by: Christian Ebner > --- > proxmox-s3-client/src/client.rs | 9 +++++---- > proxmox-s3-client/src/response_reader.rs | 21 +++++++++++++++++++-- > 2 files changed, 24 insertions(+), 6 deletions(-) >=20 > diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/clie= nt.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, HeadOb= jectResponse, > - ListBucketsResponse, ListObjectsV2Response, PutObjectResponse, Respo= nseReader, > + CopyObjectResponse, DeleteObjectsResponse, DeletedObject, GetObjectR= esponse, > + HeadObjectResponse, ListBucketsResponse, ListObjectsV2Response, PutO= bjectResponse, > + ResponseReader, > }; > =20 > /// Default timeout for s3 api requests. > @@ -544,7 +545,7 @@ impl S3Client { > =20 > /// 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= { > let object_key =3D object_key.to_full_key(&self.options.common_p= refix); > let request =3D Request::builder() > .method(Method::DELETE) > @@ -553,7 +554,7 @@ impl S3Client { > =20 > let response =3D self.send(request, None).await?; > let response_reader =3D ResponseReader::new(response); > - response_reader.delete_object_response().await > + response_reader.delete_object_response(object_key).await > } > =20 > /// Delete multiple objects from a bucket using a single HTTP reques= t. > 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 { > let (parts, _body) =3D self.response.into_parts(); > =20 > match parts.status { > @@ -369,7 +372,21 @@ impl ResponseReader { > status_code =3D> 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? > }; > =20 > - Ok(()) > + let delete_marker =3D Self::parse_optional_header( > + HeaderName::from_static("x-amz-delete-marker"), > + &parts.headers, > + )?; > + let delete_marker_version_id =3D Self::parse_optional_header( > + HeaderName::from_static("x-amz-version-id"), > + &parts.headers, > + )?; > + > + Ok(DeletedObject { > + delete_marker, > + delete_marker_version_id, > + key: Some(key), > + version_id: None, > + }) > } > =20 > /// Read and parse the delete objects response. > --=20 > 2.47.3 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20