pitrou commented on PR #41801: URL: https://github.com/apache/arrow/pull/41801#issuecomment-2130010662
We could even imagine a more peculiar API: ```c++ /// \brief Read data from current position /// /// This function reads at most `nbytes`, advancing the file position accordingly. /// It is allowed to return less bytes than requested, but will return at least one byte, /// unless EOF is encountered immediately, in which case an empty span is returned. /// /// `out_buffer` is an optional buffer that this method is allowed to resize and write to /// to satisfy the write. /// Whether `out_buffer` is used or ignored is an implementation-detail; this is to allow /// an efficient implementation of this method to avoid copies if it can instead return /// a span over an internal buffer. /// /// The returned span can be owning (in which case the owning buffer can be /// `out_buffer` or another buffer entirely) or non-owning (in which case the /// span will be a view over some internal buffer of this stream). /// /// If the return span is non-owning, it can only be accessed until the next /// operation on this stream. This makes this method more delicate to /// use correctly than a plain `Read`, but at the benefit of potentially higher /// performance. Result<BufferSpan> ReadSome(int64_t nbytes, const std::shared_ptr<ResizableBuffer>& out_buffer = nullptr); ``` -- 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]
