Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skippable blocks for streaming compression #2336

Closed
AbdulrahmanAltabba opened this issue Oct 1, 2020 · 3 comments
Closed

skippable blocks for streaming compression #2336

AbdulrahmanAltabba opened this issue Oct 1, 2020 · 3 comments
Labels

Comments

@AbdulrahmanAltabba
Copy link

I have a scenario where I continuously receive streamed data and I want to compress this data in multiple frames with a pre-given FrameSize. I am using the C-API function ZSTD_CCtx_setPledgedSrcSize() for this purpose. The problem arise when the data stream stops or requests closing the file and starting a new file in a time point when the the current frame size is not yet reached. I can't close the frame in this case. I thought I could do padding with meaningless data till the end of the frame. However, this would not be clean when decompressing the file. If one could use something like skippable blocks, then I could fill the rest of the frame with these and the decompressor would skip them automatically. This could solve my problem. Otherwise I would appreciate any help to overcome this issue.

Thank you

@terrelln
Copy link
Contributor

terrelln commented Oct 2, 2020

I am using the C-API function ZSTD_CCtx_setPledgedSrcSize() for this purpose

Why are you setting a pledged source size when it might not be accurate? Wouldn't a better solution be to not set the pledged source size, then you can have a frame of whatever size you please?

If you need to know the source size on the decompression side, you could communicate it out-of-band. That would allow you to over/under-estimate because you can have a protocol that adjusts it.

@pizzard
Copy link

pizzard commented Oct 2, 2020

after further investigation we found our analysis to be incorrect. we will look at pledged size further to see if they can work.

@Cyan4973 Cyan4973 closed this as completed Dec 1, 2020
@pizzard
Copy link

pizzard commented Dec 1, 2020

I forgot to report. Setting the pledged size actually works as expected, if you use it correctly. Having blocks with larger pledged size than actual content decompress correctly to the end and then throw an unexpected end of input error (which can be caught and handled). So this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants