Xuanwo opened a new issue, #8851:
URL: https://github.com/apache/opendal/issues/8851
> AI-authored issue from a read-only readability audit against `main`
(`615a8f24f`), guided by the optimize-for-reading guidelines in #8847.
### Problem
Several single-purpose conversion traits, unreachable trait implementations,
and pass-through shells add indirection or mislead readers without serving any
active caller:
1. **Single-purpose conversion trait `IntoMultipartCopyContext`**
(`core/core/src/raw/oio/copy/multipart_copy.rs:79-131`):
- Exists only so unit tests can omit `Capability::default()`. Both
production callers—`core/services/s3/src/copier.rs:70-72` and
`core/services/tos/src/copier.rs:65-67`—already pass `(ctx.executor().clone(),
capability)`.
- Replacing `context: impl IntoMultipartCopyContext` with explicit
`executor: Executor, capability: Capability` parameters makes the constructor
signature self-explanatory (note: check whether
`raw::oio::IntoMultipartCopyContext` is considered public raw API before
removing).
2. **Dead `impl oio::Read for ConcurrentLimitWrapper`**
(`core/layers/concurrent-limit/src/lib.rs:516-527`):
- Unused because `ConcurrentLimitService::Reader = ConcurrentLimitReader`.
- Worse, it forwards `open` and `read` without acquiring a semaphore
permit, which can mislead readers about concurrency enforcement.
3. **Dead `impl oio::ReadStream for RetryWrapper`**
(`core/layers/retry/src/lib.rs:842-850`):
- Unused because `RetryReader` uses `RetryReadStream`.
4. **Pass-through `CompleteService::stat`**
(`core/core/src/layers/complete.rs:129-132`):
- Unwraps `RpStat` via `.into_metadata()` and immediately re-wraps it in
`Ok(RpStat::new(metadata))` instead of forwarding `self.inner.stat(ctx, path,
args).await`.
5. **Unnecessary `Arc<Inner>` allocation in `FoyerService::rename`**
(`core/layers/foyer/src/lib.rs:407-419`):
- Calls `self.operation_inner(ctx)`—which clones `srv`, `ctx`, `cache`,
and `deleted_keys` into a new heap-allocated `Arc<Inner>`—solely to call
`invalidate_unversioned`. Operating directly on `self.cache` /
`self.deleted_keys` avoids both the allocation and the extra hop.
### Coordination Notes
- Open PR #8819 modifies `core/layers/foyer/src/lib.rs` and open PR #8826
modifies `core/layers/retry/src/lib.rs`. Coordinate or split per crate as
needed to avoid merge conflicts.
--
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]