Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions core/services/s3/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ impl Builder for S3Builder {
presign_stat: true,
presign_read: true,
presign_write: true,
presign_delete: true,

shared: true,

Expand Down Expand Up @@ -1123,10 +1124,7 @@ impl Access for S3Backend {
self.core
.s3_put_object_request(path, None, &v, Buffer::new())
}
PresignOperation::Delete(_) => Err(Error::new(
ErrorKind::Unsupported,
"operation is not supported",
)),
PresignOperation::Delete(v) => self.core.s3_delete_object_request(path, &v),
_ => Err(Error::new(
ErrorKind::Unsupported,
"operation is not supported",
Expand Down
8 changes: 6 additions & 2 deletions core/services/s3/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,11 @@ impl S3Core {
self.send(req).await
}

pub async fn s3_delete_object(&self, path: &str, args: &OpDelete) -> Result<Response<Buffer>> {
pub async fn s3_delete_object_request(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub async fn s3_delete_object_request(
pub fn s3_delete_object_request(

&self,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest impl is to mimic what we do for head_object

  • A function to get request: pub fn get_delete_request()
  • A function to async delete: pub async fn delete()

path: &str,
args: &OpDelete,
) -> Result<Request<Buffer>> {
let p = build_abs_path(&self.root, path);

let mut url = format!("{}/{}", self.endpoint, percent_encode_path(&p));
Expand Down Expand Up @@ -630,7 +634,7 @@ impl S3Core {
.body(Buffer::new())
.map_err(new_request_build_error)?;

self.send(req).await
Ok(req)
}

pub async fn s3_copy_object(&self, from: &str, to: &str) -> Result<Response<Buffer>> {
Expand Down
4 changes: 3 additions & 1 deletion core/services/s3/src/deleter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ impl oio::BatchDelete for S3Deleter {
return Ok(());
}

let resp = self.core.s3_delete_object(&path, &args).await?;
let req = self.core.s3_delete_object_request(&path, &args).await?;

let resp = self.core.send(req).await?;

let status = resp.status();

Expand Down
Loading