From 618d9cf53b16cd61ec6a42f49b14a17f9b0edf46 Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Tue, 11 Apr 2017 11:17:27 +0100 Subject: [PATCH] FoldHeads to output binary so that byte_size will work in sweeper --- src/leveled_bookie.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/leveled_bookie.erl b/src/leveled_bookie.erl index 6907e66..521b20e 100644 --- a/src/leveled_bookie.erl +++ b/src/leveled_bookie.erl @@ -1103,7 +1103,7 @@ accumulate_objects(FoldObjectsFun, InkerClone, Tag, DeferredFetch) -> MDBin, Size, {fun fetch_value/2, InkerClone, JK}}, - FoldObjectsFun(B, K, Value, Acc); + FoldObjectsFun(B, K, term_to_binary(Value), Acc); false -> R = fetch_value(InkerClone, JK), case R of @@ -1530,9 +1530,9 @@ foldobjects_vs_hashtree_test() -> FoldHeadsFun = fun(B, K, ProxyV, Acc) -> {proxy_object, - _MDBin, - _Size, - {FetchFun, Clone, JK}} = ProxyV, + _MDBin, + _Size, + {FetchFun, Clone, JK}} = binary_to_term(ProxyV), V = FetchFun(Clone, JK), [{B, K, erlang:phash2(term_to_binary(V))}|Acc] end, @@ -1546,9 +1546,9 @@ foldobjects_vs_hashtree_test() -> FoldHeadsFun2 = fun(B, K, ProxyV, Acc) -> {proxy_object, - MD, - _Size, - _Fetcher} = ProxyV, + MD, + _Size, + _Fetcher} = binary_to_term(ProxyV), {Hash, _Size} = MD, [{B, K, Hash}|Acc] end, @@ -1607,7 +1607,7 @@ foldobjects_vs_foldheads_bybucket_test() -> {proxy_object, _MDBin, _Size, - {FetchFun, Clone, JK}} = ProxyV, + {FetchFun, Clone, JK}} = binary_to_term(ProxyV), V = FetchFun(Clone, JK), [{B, K, erlang:phash2(term_to_binary(V))}|Acc] end,