From 81f829c43fff2f39b7d7c8b594447e1f5f52f301 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Thu, 5 Dec 2024 19:59:16 +0800 Subject: [PATCH] Fix build Signed-off-by: Xuanwo --- core/src/layers/capability_check.rs | 16 ++++++++++-- core/src/layers/complete.rs | 5 ---- core/src/layers/correctness_check.rs | 38 ++++++++-------------------- core/src/services/s3/delete.rs | 5 +--- 4 files changed, 25 insertions(+), 39 deletions(-) diff --git a/core/src/layers/capability_check.rs b/core/src/layers/capability_check.rs index 0066e031b3f1..7a5064bc6b27 100644 --- a/core/src/layers/capability_check.rs +++ b/core/src/layers/capability_check.rs @@ -82,11 +82,13 @@ impl Debug for CapabilityAccessor { impl LayeredAccess for CapabilityAccessor { type Inner = A; type Reader = A::Reader; - type BlockingReader = A::BlockingReader; type Writer = A::Writer; - type BlockingWriter = A::BlockingWriter; type Lister = A::Lister; + type Deleter = A::Deleter; + type BlockingReader = A::BlockingReader; + type BlockingWriter = A::BlockingWriter; type BlockingLister = A::BlockingLister; + type BlockingDeleter = A::BlockingDeleter; fn inner(&self) -> &Self::Inner { &self.inner @@ -123,6 +125,10 @@ impl LayeredAccess for CapabilityAccessor { self.inner.write(path, args).await } + async fn delete(&self) -> crate::Result<(RpDelete, Self::Deleter)> { + self.inner.delete().await + } + async fn list(&self, path: &str, args: OpList) -> crate::Result<(RpList, Self::Lister)> { let capability = self.info.full_capability(); if !capability.list_with_version && args.version() { @@ -175,6 +181,10 @@ impl LayeredAccess for CapabilityAccessor { self.inner.blocking_write(path, args) } + fn blocking_delete(&self) -> crate::Result<(RpDelete, Self::BlockingDeleter)> { + self.inner.blocking_delete() + } + fn blocking_list( &self, path: &str, @@ -207,9 +217,11 @@ mod tests { type Reader = oio::Reader; type Writer = oio::Writer; type Lister = oio::Lister; + type Deleter = oio::Deleter; type BlockingReader = oio::BlockingReader; type BlockingWriter = oio::BlockingWriter; type BlockingLister = oio::BlockingLister; + type BlockingDeleter = oio::BlockingDeleter; fn info(&self) -> Arc { let mut info = AccessorInfo::default(); diff --git a/core/src/layers/complete.rs b/core/src/layers/complete.rs index 92adee9eba0c..b9f8984a4c5b 100644 --- a/core/src/layers/complete.rs +++ b/core/src/layers/complete.rs @@ -384,11 +384,6 @@ impl LayeredAccess for CompleteAccessor { } async fn presign(&self, path: &str, args: OpPresign) -> Result { - let capability = self.info.full_capability(); - if !capability.presign { - return Err(self.new_unsupported_error(Operation::Presign)); - } - self.inner.presign(path, args).await } diff --git a/core/src/layers/correctness_check.rs b/core/src/layers/correctness_check.rs index a2368d54d154..13cebd2b46f5 100644 --- a/core/src/layers/correctness_check.rs +++ b/core/src/layers/correctness_check.rs @@ -76,11 +76,13 @@ impl Debug for CorrectnessAccessor { impl LayeredAccess for CorrectnessAccessor { type Inner = A; type Reader = A::Reader; - type BlockingReader = A::BlockingReader; type Writer = A::Writer; - type BlockingWriter = A::BlockingWriter; type Lister = A::Lister; + type Deleter = A::Deleter; + type BlockingReader = A::BlockingReader; + type BlockingWriter = A::BlockingWriter; type BlockingLister = A::BlockingLister; + type BlockingDeleter = A::BlockingDeleter; fn inner(&self) -> &Self::Inner { &self.inner @@ -143,17 +145,8 @@ impl LayeredAccess for CorrectnessAccessor { self.inner.stat(path, args).await } - async fn delete(&self, path: &str, args: OpDelete) -> Result { - let capability = self.info.full_capability(); - if !capability.delete_with_version && args.version().is_some() { - return Err(new_unsupported_error( - self.info.as_ref(), - Operation::Delete, - "version", - )); - } - - self.inner.delete(path, args).await + async fn delete(&self) -> Result<(RpDelete, Self::Deleter)> { + self.inner.delete().await } async fn list(&self, path: &str, args: OpList) -> Result<(RpList, Self::Lister)> { @@ -213,17 +206,8 @@ impl LayeredAccess for CorrectnessAccessor { self.inner.blocking_stat(path, args) } - fn blocking_delete(&self, path: &str, args: OpDelete) -> Result { - let capability = self.info.full_capability(); - if !capability.delete_with_version && args.version().is_some() { - return Err(new_unsupported_error( - self.info.as_ref(), - Operation::BlockingDelete, - "version", - )); - } - - self.inner().blocking_delete(path, args) + fn blocking_delete(&self) -> Result<(RpDelete, Self::BlockingDeleter)> { + self.inner.blocking_delete() } fn blocking_list(&self, path: &str, args: OpList) -> Result<(RpList, Self::BlockingLister)> { @@ -246,9 +230,11 @@ mod tests { type Reader = oio::Reader; type Writer = oio::Writer; type Lister = oio::Lister; + type Deleter = oio::Deleter; type BlockingReader = oio::BlockingReader; type BlockingWriter = oio::BlockingWriter; type BlockingLister = oio::BlockingLister; + type BlockingDeleter = oio::BlockingDeleter; fn info(&self) -> Arc { let mut info = AccessorInfo::default(); @@ -269,10 +255,6 @@ mod tests { Ok((RpWrite::new(), Box::new(()))) } - async fn delete(&self, _: &str, _: OpDelete) -> Result { - Ok(RpDelete {}) - } - async fn list(&self, _: &str, _: OpList) -> Result<(RpList, Self::Lister)> { Ok((RpList {}, Box::new(()))) } diff --git a/core/src/services/s3/delete.rs b/core/src/services/s3/delete.rs index c51c77d8b114..b2b49c84047b 100644 --- a/core/src/services/s3/delete.rs +++ b/core/src/services/s3/delete.rs @@ -56,10 +56,7 @@ impl oio::BatchDelete for S3Deleter { } async fn delete_batch(&self, batch: Vec<(String, OpDelete)>) -> Result { - // TODO: fix https://github.com/apache/opendal/issues/5329 - let paths = batch.into_iter().map(|(p, _)| p).collect(); - - let resp = self.core.s3_delete_objects(paths).await?; + let resp = self.core.s3_delete_objects(batch).await?; let status = resp.status(); if status != StatusCode::OK {