basho / riak-python-client

The Riak client for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom encoding [JIRA: CLIENTS-767]

opened this issue · comments

Can we get support to add custom encoders? At the moment, it looks like content_encoding is ignored.

Adding to the confusion is custom serialisers that are called encoders, even though they are based on content_type.

At the moment I am monkey-patching riak.content.RiakContent._serialise and _deserialise, and doing both serialisation and encoding in the one method. I've also overloaded the bucket "encoders" to handle both serialisation formats and encodings. I can send a pull request it would be helpful, but it's a fairly hacky solution at the moment.

Can you give more information about what you are trying to accomplish? Example code would be great. I can see that content_encoding really doesn't do anything.

Sure, so I'm saving blocks of highly compressible data (JSON mostly), and just want to apply some compression to it. I'm currently using lz4, but the same would apply for gzip, bz2, lzma, etc.