Open
Description
Compression other than bz2
should be supported. We don't need to go overkill, but it's sufficiently easy to compress bytes()
in Python that we may as well support some more. I would suggest maybe gzip, lz4, and an option to disable compression entirely (i.e. for input data that is already compressed).
When this feature is implemented, the compatibility level counter should be incremented.
I would make use of function pointers; i.e...
compress_data = None
if compressiontype is "bz2":
compress_data = bz2.compress
elif compressiontype is "lz4"
compress_data = ...
...
if compress_data is None:
# crash the program with an error
...
...
compressed_data = compress_data(data, compressionlevel)
Note that we will need at least one wrapper function to "compress" data for the uncompressed type, and we also might need some for any compression functions that don't support compression levels (or don't do so as the second positional argument).