Compress journal with lz4
When the value is a binary (which should be the case with Riak)
This commit is contained in:
parent
99428d0e55
commit
830906c552
1 changed files with 4 additions and 2 deletions
|
@ -270,7 +270,8 @@ maybe_compress(JournalBin) ->
|
|||
serialise_object(Object, false) when is_binary(Object) ->
|
||||
Object;
|
||||
serialise_object(Object, true) when is_binary(Object) ->
|
||||
zlib:compress(Object);
|
||||
{ok, Bin} = lz4:pack(Object),
|
||||
Bin;
|
||||
serialise_object(Object, false) ->
|
||||
term_to_binary(Object);
|
||||
serialise_object(Object, true) ->
|
||||
|
@ -297,7 +298,8 @@ revert_value_from_journal(JournalBin, ToIgnoreKeyChanges) ->
|
|||
end.
|
||||
|
||||
deserialise_object(Binary, true, true) ->
|
||||
zlib:uncompress(Binary);
|
||||
{ok, Deflated} = lz4:unpack(Binary),
|
||||
Deflated;
|
||||
deserialise_object(Binary, true, false) ->
|
||||
Binary;
|
||||
deserialise_object(Binary, false, _) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue