zstd icon indicating copy to clipboard operation
zstd copied to clipboard

Can `ZSTD_getFrameHeader()` function be moved to stable API?

Open animalize opened this issue 4 years ago • 4 comments

If the frame header will not be changed in the future, maybe ZSTD_getFrameHeader() function can be moved to stable API.

animalize avatar Jan 15 '21 12:01 animalize

The frame header itself, as an IETF RFC defined binary format, is indeed pretty stable and likely to remain this way for the foreseeable future.

That being said, the difficulty with ZSTD_getFrameHeader() is that it depends on the definition of structure ZSTD_frameHeader , which would have to become stable too. Now, even if the binary format doesn't change, the structure itself could change to support new functionalities. For example, last time we modified it, I think it was to return blockSizeMax in v1.3.2 (an information which could also be derived indirectly, showing that there are many ways to achieve the same result).

Depending on a structure definition is something we try to avoid (in general) for the stable public API, because structures are extremely rigid and can't be changed afterwards. That being said, if we are confident that the current structure is useful enough and is unlikely to change in the future, that would make it a potential candidate into stable API.

Cyan4973 avatar Jan 15 '21 20:01 Cyan4973

One potential change we want to reserve the right to make is to prescribe meaning to the reserved bits in the zstd header. In which case the ZSTD_frameHeader structure would probably need to be changed to expose that.

terrelln avatar Jan 15 '21 20:01 terrelln

If we cared to, we could consider adding an int _reserved field to the struct definition and stabilizing with that.

felixhandte avatar Mar 26 '22 01:03 felixhandte

If we cared to, we could consider adding an int _reserved field to the struct definition and stabilizing with that.

Sounds good. If the format will be changed greatly in the future, can add a ZSTD_getFrameHeaderV2() function.

ZSTD_getFrameHeader() function is convenient to get information from a frame header. (I want to use it to detect skippable frame.)

ghost avatar Mar 26 '22 05:03 ghost

Yes, it is planned now. Closing in favor of #3390.

terrelln avatar Dec 22 '22 01:12 terrelln