Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kjnilsson committed Nov 25, 2024
1 parent 6111f29 commit 347c72f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ra_log_reader.erl
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ read_plan(#?STATE{segment_refs = SegRefs}, Indexes) ->
TransformFun :: fun(),
#{ra_index() => Command :: term()}) ->
{#{ra_index() => Command :: term()}, ra_flru:state()}.
exec_read_plan(Dir, Plan, undefined, Fun, Acc0) ->
exec_read_plan(Dir, Plan, undefined, TransformFun, Acc0) ->
Open = ra_flru:new(1, fun({_, Seg}) -> ra_log_segment:close(Seg) end),
exec_read_plan(Dir, Plan, Open, Fun, Acc0);
exec_read_plan(Dir, Plan, Open0, Fun, Acc0)
exec_read_plan(Dir, Plan, Open, TransformFun, Acc0);
exec_read_plan(Dir, Plan, Open0, TransformFun, Acc0)
when is_list(Plan) ->
Fun = fun (I, T, B, Acc) ->
E = TransformFun(I, T, binary_to_term(B)),
Acc#{I => E}
end,
lists:foldl(
fun ({Idxs, BaseName}, {Acc1, Open1}) ->
{Seg, Open} = get_segment_ext(Dir, Open1, BaseName),
Fun = fun (I, T, B, Acc) ->
E = Fun(I, T, binary_to_term(B)),
Acc#{I => E}
end,
{_, Acc} = ra_log_segment:read_sparse(Seg, Idxs, Fun, Acc1),
{Acc, Open}
end, {Acc0, Open0}, Plan).
Expand Down

0 comments on commit 347c72f

Please sign in to comment.