Xuanwo opened a new pull request, #8915:
URL: https://github.com/apache/opendal/pull/8915

   # Which issue does this PR close?
   
   Closes #8854.
   
   # Rationale for this change
   
   `Copier`, `FuturesDeleteSink`, and `CompleteWriter` were already refactored 
in #8865. `BufferSink` still represented its closed state implicitly as 
`State::Idle(None)`, requiring option unwrapping on idle transitions. Replacing 
that split state with an explicit `State::Closed` variant finishes #8854 and 
aligns `BufferSink` with `FuturesDeleteSink`.
   
   # What changes are included in this PR?
   
   - Replace `State::Idle(Option<WriteState>)` in 
`core/core/src/types/write/buffer_sink.rs` with `State::Idle(WriteState)` and 
an explicit `State::Closed` variant while keeping `buf` and `position` on 
`BufferSink`.
   - Update the `unsafe impl Sync for State` safety comment to describe 
`BufferSink`'s actual `&self` / `&mut self` access invariants.
   - Add `BufferSink::take_idle_writer` and update `is_closed`, `start_send`, 
`poll_flush`, and `poll_close` to match `State` exhaustively without 
`.expect()` or `unreachable!()`, preserving close retry semantics on error.
   - Add unit tests covering close retry after failure followed by closed 
rejection, and rejecting `poll_flush` while a close is in flight without 
disturbing the pending close future.
   
   # Are there any user-facing changes?
   
   None.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: pi
   - Model: Gemini 4 Neon
   - Effort: high
   - Role: Implemented the `BufferSink` state-enum refactor and unit tests, 
verified the change locally, and drafted this pull request description. No 
assumptions or unknowns affect review.
   


-- 
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