Xuanwo opened a new pull request, #8857: URL: https://github.com/apache/opendal/pull/8857
Closes #8855. # Rationale for this change `WriteGenerator<W>` in `core/core/src/types/context/write.rs` carried an unused generic parameter: both `impl` blocks hardcoded `WriteGenerator<oio::Writer>`, so `<W>` never varied and only added noise at every use site. The name also described the wrong responsibility. The type does not generate anything; it owns the mutable state of one logical write call and drives the raw writer through it. # What changes are included in this PR? - `WriteGenerator<W>` becomes `WriteState` and stores `oio::Writer` directly. There was no `PhantomData`, no bound on `W`, and no turbofish to remove beyond the redundant `<oio::Writer>` in signatures. - The two consecutive `impl` blocks are merged; the split only existed to separate construction from the write methods and had no other purpose. - The constructor doc comment said "Create a new exact buf writer." It now names what `create` returns, and `WriteState` has a doc comment stating what the state covers (raw writer, chunk buffer, partially accepted write tracking, `copy_from` continuation). - Callers are updated: `Writer`, `BufferSink`, `FuturesAsyncWriter`, `FuturesBytesSink`, and the unit tests in `context/write.rs`, where locals named `write_gen` are now `write_state`. The name pairs with `WriteContext`: the immutable per-operation context in, the mutable per-call state out. Both are created together in `Writer::new`, which reads `WriteState::create(ctx.clone())` next to `Arc<WriteContext>`. # Are there any user-facing changes? None. `WriteState` is crate-internal: `core/core/src/types/mod.rs` re-exports `context::*` with `pub(crate) use`, so the type is not reachable from outside `opendal_core`, and no docs, bindings, or integrations refer to it. # Breaking changes None. # AI Usage Statement - Harness: pi coding agent, driven from a T3 Code thread. - Model: `deepseek` (provider `magpie`). - Effort: high. - Role: The AI performed the whole change under human direction: read issue #8855, confirmed the type is crate-internal by tracing `pub(crate) use context::*`, applied the rename and generic removal, ran the local checks below, and wrote this description. The naming choice (`WriteState` over alternatives such as `WriteDriver` or `ChunkedWriter`) is the AI's judgment, based on the type owning per-call mutable state rather than a wrapper or a chunker. `std_writer.rs` and other files touched by open PR #8846 were left untouched, though this PR does conflict with #8846 in `buffer_sink.rs` and `futures_async_writer.rs` where both change the same signature lines. Local verification on `a4ea7deed` plus this commit: - `cargo fmt --all -- --check` — no output, exit 0. - `cargo clippy -p opendal-core --all-targets -- -D warnings` — clean. - `cargo test -p opendal-core --lib` — 427 passed, 0 failed. -- 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]
