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

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 5a4eaa76c6 refactor(core): inline layer apply_service and narrow 
internal wrapper visibility (#8936)
5a4eaa76c6 is described below

commit 5a4eaa76c6567045e2146e6d985c101061943530
Author: Xuanwo <[email protected]>
AuthorDate: Tue Nov 24 04:13:56 2026 +0800

    refactor(core): inline layer apply_service and narrow internal wrapper 
visibility (#8936)
---
 core/core/src/layers/capability_override.rs | 12 +++---------
 core/core/src/layers/error_context.rs       | 12 +++---------
 core/core/src/layers/simulate.rs            | 22 ++++++++--------------
 3 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/core/core/src/layers/capability_override.rs 
b/core/core/src/layers/capability_override.rs
index 31208c433e..e5fce333ee 100644
--- a/core/core/src/layers/capability_override.rs
+++ b/core/core/src/layers/capability_override.rs
@@ -87,20 +87,14 @@ impl CapabilityOverrideLayer {
 
 impl Layer for CapabilityOverrideLayer {
     fn apply_service(&self, inner: Servicer) -> Servicer {
-        Arc::new(self.layer(inner))
-    }
-}
-
-impl CapabilityOverrideLayer {
-    fn layer(&self, inner: Servicer) -> CapabilityOverrideService {
-        CapabilityOverrideService {
+        Arc::new(CapabilityOverrideService {
             inner,
             apply: self.apply.clone(),
-        }
+        })
     }
 }
 
-pub struct CapabilityOverrideService {
+struct CapabilityOverrideService {
     inner: Servicer,
     apply: Arc<dyn Fn(Capability) -> Capability + Send + Sync>,
 }
diff --git a/core/core/src/layers/error_context.rs 
b/core/core/src/layers/error_context.rs
index 83086dd063..839ee45493 100644
--- a/core/core/src/layers/error_context.rs
+++ b/core/core/src/layers/error_context.rs
@@ -49,18 +49,12 @@ impl std::fmt::Debug for ErrorContextLayer {
 
 impl Layer for ErrorContextLayer {
     fn apply_service(&self, inner: Servicer) -> Servicer {
-        Arc::new(self.layer(inner))
-    }
-}
-
-impl ErrorContextLayer {
-    fn layer(&self, inner: Servicer) -> ErrorContextService {
-        ErrorContextService { inner }
+        Arc::new(ErrorContextService { inner })
     }
 }
 
 /// Provide error context wrapper for backend.
-pub struct ErrorContextService {
+struct ErrorContextService {
     inner: Servicer,
 }
 
@@ -221,7 +215,7 @@ impl Service for ErrorContextService {
     }
 }
 
-pub struct ErrorContextWrapper<T> {
+struct ErrorContextWrapper<T> {
     scheme: &'static str,
     path: String,
     inner: T,
diff --git a/core/core/src/layers/simulate.rs b/core/core/src/layers/simulate.rs
index 4ee0d2e44f..01c4606dac 100644
--- a/core/core/src/layers/simulate.rs
+++ b/core/core/src/layers/simulate.rs
@@ -111,21 +111,15 @@ impl SimulateLayer {
 
 impl Layer for SimulateLayer {
     fn apply_service(&self, srv: Servicer) -> Servicer {
-        Arc::new(self.layer(srv))
-    }
-}
-
-impl SimulateLayer {
-    fn layer(&self, srv: Servicer) -> SimulateService {
-        SimulateService {
+        Arc::new(SimulateService {
             srv,
             config: self.clone(),
-        }
+        })
     }
 }
 
 /// Service that applies capability simulation.
-pub struct SimulateService {
+struct SimulateService {
     srv: Servicer,
     config: SimulateLayer,
 }
@@ -431,14 +425,14 @@ impl Service for SimulateService {
     }
 }
 
-pub type SimulateLister = FourWays<
+type SimulateLister = FourWays<
     oio::Lister,
     ServicerFlatLister,
     PrefixLister<oio::Lister>,
     PrefixLister<ServicerFlatLister>,
 >;
 
-pub struct SimulateReader {
+struct SimulateReader {
     ctx: OperationContext,
     srv: Servicer,
     path: String,
@@ -641,7 +635,7 @@ enum NextDir {
     Listing(PendingDir, oio::Lister),
 }
 
-pub struct ServicerFlatLister {
+struct ServicerFlatLister {
     ctx: OperationContext,
     srv: Servicer,
     directory_args: OpList,
@@ -812,7 +806,7 @@ impl oio::List for ServicerFlatLister {
 }
 
 /// Deleter wrapper that simulates recursive deletion.
-pub struct SimulateDeleter {
+struct SimulateDeleter {
     ctx: OperationContext,
     srv: Servicer,
     config: SimulateLayer,
@@ -820,7 +814,7 @@ pub struct SimulateDeleter {
 }
 
 impl SimulateDeleter {
-    pub fn new(
+    fn new(
         ctx: OperationContext,
         srv: Servicer,
         config: SimulateLayer,

Reply via email to