Improved unit test of CRC chekcing in bloom filter

Confirm the impact of bit-flipping in the bloom filter
This commit is contained in:
martinsumner 2016-10-21 16:08:41 +01:00
parent 3710d09fbf
commit 0a2053b557
3 changed files with 68 additions and 25 deletions

View file

@ -40,6 +40,7 @@
is_active/2,
endkey_passed/2,
key_dominates/2,
maybe_reap_expiredkey/2,
print_key/1,
to_ledgerkey/3,
to_ledgerkey/5,
@ -86,6 +87,20 @@ key_dominates(LeftKey, RightKey) ->
right_hand_dominant
end.
maybe_reap_expiredkey(KV, IsBasement) ->
Status = strip_to_statusonly(KV),
maybe_reap(Status, IsBasement).
maybe_reap({_, infinity}, _) ->
false; % key is not set to expire
maybe_reap({_, TS}, {basement, CurrTS}) when CurrTS > TS ->
true; % basement and ready to expire
maybe_reap(tomb, {basement, _CurrTS}) ->
true; % always expire in basement
maybe_reap(_, _) ->
false.
is_active(Key, Value) ->
case strip_to_statusonly({Key, Value}) of
{active, infinity} ->