Mas d31 i416 (#418)

* Add compression controls (#417)

* Add compression controls

Add configuration options to allow for a compression algorithm of `none` to disable compression altogether.  Also an option to change the point in the LSM tree when compression is applied.

* Handle configurable defaults consistently

Move them into leveled.hrl.  This forces double-definitions to be resolved.

There are some other constants in leveled_bookie that are relevant outside of leveled_bookie.  These are all now in the non-configurable startup defaults section.

* Clarify referred-to default is OTP not leveled

* Update leveled_bookie.erl

Handle xref issue with eunit include
This commit is contained in:
Martin Sumner 2023-11-07 14:58:43 +00:00 committed by GitHub
parent b96518c32a
commit 9e804924a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 338 additions and 163 deletions

View file

@ -106,7 +106,7 @@
-type object_spec() ::
object_spec_v0()|object_spec_v1().
-type compression_method() ::
lz4|native.
lz4|native|none.
-type index_specs() ::
list({add|remove, any(), any()}).
-type journal_keychanges() ::
@ -508,7 +508,9 @@ serialise_object(Object, true, Method) when is_binary(Object) ->
{ok, Bin} = lz4:pack(Object),
Bin;
native ->
zlib:compress(Object)
zlib:compress(Object);
none ->
Object
end;
serialise_object(Object, false, _Method) ->
term_to_binary(Object);
@ -554,7 +556,8 @@ encode_valuetype(IsBinary, IsCompressed, Method) ->
Bit3 =
case Method of
lz4 -> 4;
native -> 0
native -> 0;
none -> 0
end,
Bit2 =
case IsBinary of
@ -562,7 +565,7 @@ encode_valuetype(IsBinary, IsCompressed, Method) ->
false -> 0
end,
Bit1 =
case IsCompressed of
case IsCompressed and (Method =/= none) of
true -> 1;
false -> 0
end,