Repository navigation
Add ZSTD_decompressScatter(): decompress into multiple output buffers - #4799
ceedot-rock wants to merge 1 commit into
Conversation
|
Hi @ceedot-rock! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Decompresses one source buffer into an ordered array of ZSTD_outBuffer destinations, filling them in order. Built on top of ZSTD_decompressStream, so multiple concatenated frames are supported. Returns the total bytes written, or ZSTD_error_dstSize_tooSmall when the combined destination capacity falls short. Adds tests/scatterGatherTest.c (8 tests) and a Makefile target.
fe3a67f to
8dfe24f
Compare
Related to #2345.
Adds ZSTD_decompressScatter(ZSTD_outBuffer* dsts, size_t nbDsts, const void* src, size_t srcSize): decompresses one input into an ordered array of output buffers, filling dst[0], then dst[1], and so on. Built on ZSTD_decompressStream, purely additive - the existing decompressor is untouched.
Scoping note: #2345's main ask is scatter-gather input for dictionary training; this PR covers the decompression-scatter half, which is the generally useful primitive (no gather copy on receive paths). Compression gather and dict-training gather are not attempted here.
The entry pos of each outBuffer is honored as the write offset, following the streaming-struct convention. Short total capacity -> dstSize_tooSmall; empty input is an error (unlike ZSTD_decompress returning 0 for it).
Tests: new tests/scatterGatherTest.c, 8/8 pass - odd-size buffers byte-identical to single-buffer decompress, nbDsts=1 equals ZSTD_decompress, zero-length middle buffer, 1-byte-short capacity, 2-frame concat, truncated input, bad params. ASan/UBSan clean, 300 fuzzer iterations clean.
Slid Phi Labs accepts donations to keep the lab independent.