Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo committed Dec 5, 2024
1 parent bd58401 commit 81f829c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 39 deletions.
16 changes: 14 additions & 2 deletions core/src/layers/capability_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ impl<A: Access> Debug for CapabilityAccessor<A> {
impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
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
Expand Down Expand Up @@ -123,6 +125,10 @@ impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
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() {
Expand Down Expand Up @@ -175,6 +181,10 @@ impl<A: Access> LayeredAccess for CapabilityAccessor<A> {
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,
Expand Down Expand Up @@ -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<AccessorInfo> {
let mut info = AccessorInfo::default();
Expand Down
5 changes: 0 additions & 5 deletions core/src/layers/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,6 @@ impl<A: Access> LayeredAccess for CompleteAccessor<A> {
}

async fn presign(&self, path: &str, args: OpPresign) -> Result<RpPresign> {
let capability = self.info.full_capability();
if !capability.presign {
return Err(self.new_unsupported_error(Operation::Presign));
}

self.inner.presign(path, args).await
}

Expand Down
38 changes: 10 additions & 28 deletions core/src/layers/correctness_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ impl<A: Access> Debug for CorrectnessAccessor<A> {
impl<A: Access> LayeredAccess for CorrectnessAccessor<A> {
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
Expand Down Expand Up @@ -143,17 +145,8 @@ impl<A: Access> LayeredAccess for CorrectnessAccessor<A> {
self.inner.stat(path, args).await
}

async fn delete(&self, path: &str, args: OpDelete) -> Result<RpDelete> {
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)> {
Expand Down Expand Up @@ -213,17 +206,8 @@ impl<A: Access> LayeredAccess for CorrectnessAccessor<A> {
self.inner.blocking_stat(path, args)
}

fn blocking_delete(&self, path: &str, args: OpDelete) -> Result<RpDelete> {
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)> {
Expand All @@ -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<AccessorInfo> {
let mut info = AccessorInfo::default();
Expand All @@ -269,10 +255,6 @@ mod tests {
Ok((RpWrite::new(), Box::new(())))
}

async fn delete(&self, _: &str, _: OpDelete) -> Result<RpDelete> {
Ok(RpDelete {})
}

async fn list(&self, _: &str, _: OpList) -> Result<(RpList, Self::Lister)> {
Ok((RpList {}, Box::new(())))
}
Expand Down
5 changes: 1 addition & 4 deletions core/src/services/s3/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ impl oio::BatchDelete for S3Deleter {
}

async fn delete_batch(&self, batch: Vec<(String, OpDelete)>) -> Result<BatchDeleteResult> {
// 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 {
Expand Down

0 comments on commit 81f829c

Please sign in to comment.