Dynamic compression APIs
Hi,
I maintain a fork of LevelDB (https://github.com/pmmp/leveldb) for reading Minecraft Bedrock worlds. The only significant difference between mojang/leveldb and google/leveldb is that mojang/leveldb uses more compression types instead of Snappy (primarily zlib).
I currently maintain a fork of google/leveldb to implement support for zlib, and recently realized it might be much better if LevelDB had some dynamic compression APIs, so that custom compressors can be used without making LevelDB depend on every compression library under the sun, and so that other users of LevelDB don't have to fork LevelDB in order to use their own compression algorithms.
This would require the following:
- Ability to dynamically map compression IDs to decompressor callbacks (Snappy would remain as 1, everything else would be user-defined)
- Ability to provide a custom compressor callback (and compression ID) for output of compressed data.
Is this the kind of change that would be suitable for LevelDB itself, or should I continue to maintain a fork? Thanks.
The addition of zstd as hardcoded ID 2 now makes upstream compatibility with google/leveldb a pain for anyone who used ID 2 for a different compression type.