This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch 
xuanwo/refactor-remove-copy-context-and-complete-stat-wrappers
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit bba9793def18f066e82c0b1d684befb22cad5331
Author: Xuanwo <[email protected]>
AuthorDate: Mon Nov 23 13:39:41 2026 +0100

    refactor(core)!: remove IntoMultipartCopyContext and CompleteService 
pass-through wrappers
---
 core/core/src/docs/upgrade.md                |  8 +++++
 core/core/src/layers/complete.rs             | 25 +++++--------
 core/core/src/raw/oio/copy/multipart_copy.rs | 52 +++++++++++++++-------------
 core/services/s3/src/copier.rs               |  3 +-
 core/services/tos/src/copier.rs              |  3 +-
 5 files changed, 49 insertions(+), 42 deletions(-)

diff --git a/core/core/src/docs/upgrade.md b/core/core/src/docs/upgrade.md
index 8046667f64..b576421fd5 100644
--- a/core/core/src/docs/upgrade.md
+++ b/core/core/src/docs/upgrade.md
@@ -125,6 +125,14 @@ available bytes. Keep using `oio::Read::read` for an exact 
bounded range.
 
 `raw::ConcurrentTasks::create_task` has been removed. Submit inputs with 
`execute()` and collect outputs in submission order with `next()`. These 
methods keep task ownership, completion accounting, and retry handling inside 
the queue. If code needs input data after successful completion, include that 
data in the factory's output type.
 
+### Explicit executor and capability in `oio::MultipartCopier::new`
+
+`raw::oio::IntoMultipartCopyContext` has been removed, and
+`raw::oio::MultipartCopier::new` now takes `executor: Executor` and
+`capability: Capability` as explicit parameters instead of a single
+`impl IntoMultipartCopyContext` argument. Pass `executor` and `capability`
+separately when constructing a `MultipartCopier`.
+
 ## Services
 
 ### Redb requires `redb` 5
diff --git a/core/core/src/layers/complete.rs b/core/core/src/layers/complete.rs
index 42b6f13499..696daf7ec7 100644
--- a/core/core/src/layers/complete.rs
+++ b/core/core/src/layers/complete.rs
@@ -34,18 +34,12 @@ impl std::fmt::Debug for CompleteLayer {
 
 impl Layer for CompleteLayer {
     fn apply_service(&self, inner: Servicer) -> Servicer {
-        Arc::new(self.layer(inner))
-    }
-}
-
-impl CompleteLayer {
-    fn layer(&self, inner: Servicer) -> CompleteService {
-        CompleteService { inner }
+        Arc::new(CompleteService { inner })
     }
 }
 
 /// Provide complete wrapper for backend.
-pub struct CompleteService {
+struct CompleteService {
     inner: Servicer,
 }
 
@@ -127,8 +121,7 @@ impl Service for CompleteService {
     }
 
     async fn stat(&self, ctx: &OperationContext, path: &str, args: OpStat) -> 
Result<RpStat> {
-        let metadata = self.inner.stat(ctx, path, args).await?.into_metadata();
-        Ok(RpStat::new(metadata))
+        self.inner.stat(ctx, path, args).await
     }
 
     fn delete(&self, ctx: &OperationContext) -> Result<Self::Deleter> {
@@ -150,7 +143,7 @@ impl Service for CompleteService {
     }
 }
 
-pub struct CompleteCopier {
+struct CompleteCopier {
     inner: oio::Copier,
     source_content_length_hint: Option<u64>,
     copied: Option<u64>,
@@ -218,7 +211,7 @@ impl oio::Copy for CompleteCopier {
     }
 }
 
-pub struct CompleteLister {
+struct CompleteLister {
     inner: oio::Lister,
     ctx: OperationContext,
     srv: Servicer,
@@ -279,12 +272,12 @@ impl oio::List for CompleteLister {
     }
 }
 
-pub struct CompleteReader<R> {
+struct CompleteReader<R> {
     inner: R,
 }
 
 impl<R> CompleteReader<R> {
-    pub fn new(inner: R) -> Self {
+    fn new(inner: R) -> Self {
         Self { inner }
     }
 }
@@ -425,14 +418,14 @@ impl State {
     }
 }
 
-pub struct CompleteWriter {
+struct CompleteWriter {
     append: bool,
     size: u64,
     state: State,
 }
 
 impl CompleteWriter {
-    pub fn new(inner: oio::Writer, append: bool) -> CompleteWriter {
+    fn new(inner: oio::Writer, append: bool) -> CompleteWriter {
         CompleteWriter {
             append,
             size: 0,
diff --git a/core/core/src/raw/oio/copy/multipart_copy.rs 
b/core/core/src/raw/oio/copy/multipart_copy.rs
index b14f4d11ab..c78a0bab56 100644
--- a/core/core/src/raw/oio/copy/multipart_copy.rs
+++ b/core/core/src/raw/oio/copy/multipart_copy.rs
@@ -75,24 +75,6 @@ struct CopyInput<C: MultipartCopy> {
     range: BytesRange,
 }
 
-/// Build executor and capability inputs for [`MultipartCopier`].
-pub trait IntoMultipartCopyContext {
-    /// Convert into executor and capability.
-    fn into_multipart_copy_context(self) -> (Executor, Capability);
-}
-
-impl IntoMultipartCopyContext for Executor {
-    fn into_multipart_copy_context(self) -> (Executor, Capability) {
-        (self, Capability::default())
-    }
-}
-
-impl IntoMultipartCopyContext for (Executor, Capability) {
-    fn into_multipart_copy_context(self) -> (Executor, Capability) {
-        self
-    }
-}
-
 struct CopiedPart {
     part: MultipartPart,
     size: u64,
@@ -131,14 +113,14 @@ pub struct MultipartCopier<C: MultipartCopy> {
 impl<C: MultipartCopy> MultipartCopier<C> {
     /// Create a new MultipartCopier.
     pub fn new(
-        context: impl IntoMultipartCopyContext,
+        executor: Executor,
+        capability: Capability,
         inner: C,
         source_content_length_hint: Option<u64>,
         copy_once_threshold: u64,
         part_size: u64,
         concurrent: usize,
     ) -> Self {
-        let (executor, capability) = context.into_multipart_copy_context();
         let copier = Arc::new(inner);
         let concurrent = concurrent.max(1);
 
@@ -497,8 +479,15 @@ mod tests {
     #[tokio::test]
     async fn test_content_length_hint_skips_source_metadata() -> Result<()> {
         let inner = TestCopy::new(8);
-        let mut copier =
-            MultipartCopier::new(crate::test_executor(), inner.clone(), 
Some(8), 8, 8, 1);
+        let mut copier = MultipartCopier::new(
+            crate::test_executor(),
+            Capability::default(),
+            inner.clone(),
+            Some(8),
+            8,
+            8,
+            1,
+        );
 
         let metadata = copier.close().await?;
         assert_eq!(inner.source_metadata_calls.load(Ordering::Relaxed), 0);
@@ -511,7 +500,15 @@ mod tests {
     #[tokio::test]
     async fn test_missing_content_length_hint_loads_source_metadata() -> 
Result<()> {
         let inner = TestCopy::new(8);
-        let mut copier = MultipartCopier::new(crate::test_executor(), 
inner.clone(), None, 8, 8, 1);
+        let mut copier = MultipartCopier::new(
+            crate::test_executor(),
+            Capability::default(),
+            inner.clone(),
+            None,
+            8,
+            8,
+            1,
+        );
 
         let metadata = copier.close().await?;
         assert_eq!(inner.source_metadata_calls.load(Ordering::Relaxed), 1);
@@ -532,7 +529,8 @@ mod tests {
         // source_size=10, part_size=1, copy_once_threshold=0 -> 10 parts 
needed, only 2 allowed.
         let inner = TestCopy::new(10);
         let mut copier = MultipartCopier::new(
-            /*context=*/ (crate::test_executor(), capability),
+            /*executor=*/ crate::test_executor(),
+            /*capability=*/ capability,
             /*inner=*/ inner.clone(),
             /*source_content_length_hint=*/ Some(10),
             /*copy_once_threshold=*/ 0,
@@ -632,6 +630,7 @@ mod tests {
         let state = inner.state.clone();
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner,
             Some(8),
             /*copy_once_threshold=*/ 0,
@@ -658,6 +657,7 @@ mod tests {
         let state = inner.state.clone();
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner,
             Some(8),
             /*copy_once_threshold=*/ 0,
@@ -697,6 +697,7 @@ mod tests {
         let inner = TestCopy::new(8);
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner.clone(),
             Some(8),
             /*copy_once_threshold=*/ 0,
@@ -731,6 +732,7 @@ mod tests {
         let inner = TestCopy::new(8);
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner.clone(),
             Some(8),
             /*copy_once_threshold=*/ 0,
@@ -764,6 +766,7 @@ mod tests {
         let inner = TestCopy::with_abort_failures(8, 1);
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner.clone(),
             Some(8),
             /*copy_once_threshold=*/ 0,
@@ -813,6 +816,7 @@ mod tests {
         let inner = TestCopy::new(8);
         let mut copier = MultipartCopier::new(
             crate::test_executor(),
+            Capability::default(),
             inner.clone(),
             Some(8),
             /*copy_once_threshold=*/ 0,
diff --git a/core/services/s3/src/copier.rs b/core/services/s3/src/copier.rs
index 45f710c513..acebd6b39e 100644
--- a/core/services/s3/src/copier.rs
+++ b/core/services/s3/src/copier.rs
@@ -68,7 +68,8 @@ pub fn new_s3_copier(
     let concurrent = args.concurrent();
 
     Ok(oio::MultipartCopier::new(
-        (ctx.executor().clone(), capability),
+        ctx.executor().clone(),
+        capability,
         S3Copier {
             core,
             ctx: ctx.clone(),
diff --git a/core/services/tos/src/copier.rs b/core/services/tos/src/copier.rs
index 261112f413..2e6735d5d4 100644
--- a/core/services/tos/src/copier.rs
+++ b/core/services/tos/src/copier.rs
@@ -63,7 +63,8 @@ pub fn new_tos_copier(
     let concurrent = args.concurrent();
 
     Ok(oio::MultipartCopier::new(
-        (ctx.executor().clone(), capability),
+        ctx.executor().clone(),
+        capability,
         TosCopier {
             core,
             ctx: ctx.clone(),

Reply via email to