Xuanwo commented on code in PR #5835:
URL: https://github.com/apache/arrow-rs/pull/5835#discussion_r1636653814
##########
object_store/src/buffered.rs:
##########
@@ -289,6 +289,58 @@ impl BufWriter {
}
}
+ /// Write data to the writer in [`Bytes`].
+ ///
+ /// Unlike [`AsyncWrite::poll_write`], `put` can write data without extra
copying.
+ ///
+ /// This API is recommended while the data source generates [`Bytes`].
+ pub async fn put(&mut self, bytes: Bytes) -> crate::Result<()> {
+ loop {
+ return match &mut self.state {
+ BufWriterState::Write(Some(write)) => {
+ write.wait_for_capacity(self.max_concurrency).await?;
+ write.put(bytes);
+ Ok(())
+ }
+ BufWriterState::Write(None) | BufWriterState::Flush(_) => {
+ panic!("Already shut down")
Review Comment:
Following the same behavior in `poll_write`. It should not happen that `put`
come into this state.
I'm fine if we want to return error in both cases.
--
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]