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

Why does startproc reset the compression stream / context? #57

Open
mkitti opened this issue Jun 2, 2024 · 0 comments
Open

Why does startproc reset the compression stream / context? #57

mkitti opened this issue Jun 2, 2024 · 0 comments

Comments

@mkitti
Copy link
Member

mkitti commented Jun 2, 2024

#4 reset the stream for some reason by introducing a call to ZSTD_resetCStream from startproc. I'm trying to understand why.

startproc now calls LibZstd.ZSTD_CCtx_reset and LibZstd.ZSTD_CCtx_setPledgedSrcSize since ZSTD_resetCStream is deprecated. We only call ZSTD_CCtx_reset to reset the session parameters.

ZSTD_resetCStream has the following documentation note.

  • start a new frame, using same parameters from previous frame.
  • This is typically useful to skip dictionary loading stage, since it will reuse it in-place.

ZSTD_CCtx_reset has the following documentation note for the session.

The session : will stop compressing current frame, and make CCtx ready to start a new one.
Useful after an error, or to interrupt any ongoing compression.
Any internal data not yet flushed is cancelled.
Compression parameters and dictionary remain unchanged.
They will be used to compress next frame.
Resetting session never fails.

Perhap we should only be calling ZSTD_CCtx_reset after an error is thrown in process?

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

No branches or pull requests

1 participant