Description
opened on Dec 3, 2024
Is your feature request related to a problem? Please describe.
In my project I am commiting data into Fjall using Batch from a iterator of Bytes. The current Batch's insert method only supports taking values by ref (AsRef<&[u8]>
) and hence makes a needless copy into UserValue (type alias to Slice).
Describe the solution you'd like
I'd like to minimize needless copies in my write path. Some possible solutions:
- modify the insert method to support values that are
Into<Slice>
. To retain compatibility with existing code this would also requireimpl<T: AsRef<&[u8]>> From<T> for Slice
... which I think should be fine to implement? - add a second insert method to batch that supports this kind of zero copy - could be feature flagged under bytes
- extract commit out of Batch and have it take in an iterator of (&Partition, key, value) such that key/value are
Into<Slice>
Describe alternatives you've considered
The current work around is just using batch. But it causes a lot of needless allocation.
Additional context
Happy to brainstorm on this!
Activity