Skip to content

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

@mkitti

Description

@mkitti

#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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions