alamb commented on code in PR #10220:
URL: https://github.com/apache/arrow-rs/pull/10220#discussion_r3485904779
##########
arrow-ipc/src/compression.rs:
##########
@@ -26,14 +27,25 @@ const LENGTH_OF_PREFIX_DATA: i64 = 8;
///
/// In the case of zstd, this will contain the zstd context, which can be
reused between subsequent
/// compression calls to avoid the performance overhead of initialising a new
context for every
-/// compression.
+/// compression. Also holds a [`FlatBufferBuilder`] that is reused across IPC
writes.
#[derive(Default)]
pub struct CompressionContext {
+ fbb: FlatBufferBuilder<'static>,
#[cfg(feature = "zstd")]
compressor: Option<zstd::bulk::Compressor<'static>>,
}
impl CompressionContext {
+ /// Takes the stored fbb, leaving a zero-capacity placeholder. Must be
returned via [`Self::return_fbb`].
+ pub(crate) fn take_fbb(&mut self) -> FlatBufferBuilder<'static> {
Review Comment:
Do you need to provide a take/return? Would it be possible to just reutrn a
mut reference?
LIke
```rust
pub(crate) fn fbb_mut(&mut self) -> & mut FlatBufferBuilder<'static> {
```
I think that would simplify the code a bit (and wouldn't require creating an
empyt builder either)
--
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]