Xuanwo opened a new issue, #8850:
URL: https://github.com/apache/opendal/issues/8850

   > AI-authored issue from a read-only readability audit against `main` 
(`615a8f24f`), guided by the optimize-for-reading guidelines in #8847.
   
   ### Problem
   
   Following #7743 (`Layer::apply_service(&self, inner: Servicer) -> 
Servicer`), newer layers such as `GlobLayer` 
(`core/core/src/layers/glob.rs:38-43`) and `HedgeLayer` 
(`core/layers/hedge/src/lib.rs:150-165`) construct their private `*Service` 
wrapper directly inside `apply_service`.
   
   However, 23 existing layers still retain a private `fn layer(&self, inner: 
Servicer) -> FooService/FooAccessor` trampoline called only by a one-line 
`Arc::new(self.layer(inner))` in `apply_service`, along with `#[doc(hidden)] 
pub struct` visibility (with zero external references across `core/src/`, 
`bindings/`, `integrations/`, and `examples/`):
   
   - `core/core/src/layers/` (5): `capability_override.rs`, `complete.rs`, 
`correctness_check.rs`, `error_context.rs`, `simulate.rs`
   - `core/layers/` (18): `async-backtrace`, `await-tree`, `capability-check`, 
`chaos`, `concurrent-limit`, `dtrace`, `foyer`, `hotpath`, `immutable-index`, 
`logging`, `mime-guess`, `observe-metrics-common`, `oteltrace`, `retry`, 
`route`, `tail-cut`, `throttle`, `tracing`
   
   In addition:
   - 8 layer wrappers still use the legacy `*Accessor` name (including 
`FastraceAccessor`, which already constructs directly in `apply_service`):
     - `AsyncBacktraceAccessor` (`core/layers/async-backtrace/src/lib.rs:134`)
     - `AwaitTreeAccessor` (`core/layers/await-tree/src/lib.rs:162`)
     - `FastraceAccessor` (`core/layers/fastrace/src/lib.rs:218`)
     - `HotpathAccessor` (`core/layers/hotpath/src/lib.rs:110`)
     - `MetricsAccessor` (`core/layers/observe-metrics-common/src/lib.rs:736`)
     - `MimeGuessAccessor` (`core/layers/mime-guess/src/lib.rs:92`)
     - `RouteAccessor` (`core/layers/route/src/lib.rs:176`)
     - `ThrottleAccessor` (`core/layers/throttle/src/lib.rs:132`)
   - `RouteLayer` (`core/layers/route/src/lib.rs:169`) wraps `inner: Servicer` 
(already `Arc<dyn ServiceDyn>`) in a redundant second `Arc::new(inner)`.
   
   ### Proposed Change
   
   - Inline service wrapper construction directly into `Layer::apply_service` 
and remove the leftover `fn layer(&self, ...)` trampolines across the 23 layers.
   - Drop unnecessary `#[doc(hidden)] pub` visibility on internal wrapper 
structs where nothing outside the crate names them, and rename the 8 
`*Accessor` wrappers to `*Service`.
   - Remove the double `Arc::new(inner)` in `RouteLayer`.
   
   ### Coordination Notes
   
   - Open PRs #8819 (`core/layers/foyer/src/lib.rs`) and #8826 
(`core/layers/retry/src/lib.rs`) currently modify two of these crates. Either 
sequence after those PRs merge or split into small, reviewable batches (per 
`CONTRIBUTING.md` PR size guidance).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to