libzip
libzip copied to clipboard
Provide ways to extend/layer on top of builtin source types
Description
A mechanism to extend builtin source types could be proven useful. For example a user might want to implement an "owning" zip_source_zip like source type that discards the source archive on ZIP_SOURCE_FREE. Right now I don't see a way to do this through the documented interface.
There is an internal zip_source_layered* interface that allows doing something like this, maybe that could be exposed to the public API.
Solution
Expose zip_source_layered* .
Describe alternatives you've considered
Provide an alternative interface with similar capabilities.
I agree that zip_source_layered() should be made public. But we need to make sure we get the interface just right; once made public, it's hard to change.
Also, we need to document how each operation interacts with the layer below, and what is expected from a layered source.
We have made the API for layered sources public, and added your example as examples/autoclose-archive.c
If you have questions or suggestions regarding the API, please contact us. If any issues with the API are found, we can still fix them before the next release, after which the API is official.