Simplify SnapSQN check

Less ugly
This commit is contained in:
Martin Sumner 2017-11-01 19:31:20 +00:00
parent 6e0bf7bce3
commit 6beeadc7d8

View file

@ -390,16 +390,13 @@ handle_call({register_snapshot, Requestor}, _From , State) ->
State#state.active_journaldb}, State#state.active_journaldb},
State#state{registered_snapshots=Rs}}; State#state{registered_snapshots=Rs}};
handle_call({confirm_delete, ManSQN}, _From, State) -> handle_call({confirm_delete, ManSQN}, _From, State) ->
Reply = lists:foldl(fun({_R, SnapSQN}, Bool) -> CheckSQNFun =
case SnapSQN >= ManSQN of fun({_R, SnapSQN}, Bool) ->
true -> (SnapSQN >= ManSQN) and Bool
Bool; end,
false -> {reply,
false lists:foldl(CheckSQNFun, true, State#state.registered_snapshots),
end end, State};
true,
State#state.registered_snapshots),
{reply, Reply, State};
handle_call(get_manifest, _From, State) -> handle_call(get_manifest, _From, State) ->
{reply, leveled_imanifest:to_list(State#state.manifest), State}; {reply, leveled_imanifest:to_list(State#state.manifest), State};
handle_call({update_manifest, handle_call({update_manifest,