Fold Objects - Check values test

Test that summed values in fold objects before and after restart
This commit is contained in:
martinsumner 2016-11-04 14:23:37 +00:00
parent ba628c2f40
commit eeeee07081
3 changed files with 48 additions and 8 deletions

View file

@ -528,16 +528,22 @@ foldobjects(State, Tag, StartKey, EndKey, FoldObjectsFun) ->
{ok,
{LedgerSnapshot, LedgerCache},
JournalSnapshot} = snapshot_store(State, store),
{FoldFun, InitAcc} = case is_tuple(FoldObjectsFun) of
true ->
FoldObjectsFun;
false ->
{FoldObjectsFun, []}
end,
Folder = fun() ->
leveled_log:log("B0004", [gb_trees:size(LedgerCache)]),
ok = leveled_penciller:pcl_loadsnapshot(LedgerSnapshot,
LedgerCache),
AccFun = accumulate_objects(FoldObjectsFun, JournalSnapshot, Tag),
AccFun = accumulate_objects(FoldFun, JournalSnapshot, Tag),
Acc = leveled_penciller:pcl_fetchkeys(LedgerSnapshot,
StartKey,
EndKey,
AccFun,
[]),
InitAcc),
ok = leveled_penciller:pcl_close(LedgerSnapshot),
ok = leveled_inker:ink_close(JournalSnapshot),
Acc