Permalink
Browse files

Eliminate requirement for {done, VNode} tuple for coverage results fi…

…nalization.
  • Loading branch information...
1 parent b1201d3 commit 1807da6f134e604e924273c74fc17c97b2f979f0 @kellymclaughlin kellymclaughlin committed Jul 18, 2011
Showing with 8 additions and 21 deletions.
  1. +8 −21 src/riak_core_coverage_fsm.erl
View
29 src/riak_core_coverage_fsm.erl
@@ -219,42 +219,29 @@ initialize(timeout, StateData0=#state{mod=Mod,
end.
%% @private
-waiting_results({ReqId, {done, VNode}},
+waiting_results({ReqId, Results},
StateData=#state{coverage_vnodes=CoverageVNodes,
mod=Mod,
mod_state=ModState,
req_id=ReqId,
timeout=Timeout}) ->
- case lists:member(VNode, CoverageVNodes) of
- true -> % Received an expected response from a Vnode
+ case Mod:process_results(Results, CoverageVNodes, ModState) of
+ {done, VNode, UpdModState} ->
UpdatedVNodes = lists:delete(VNode, CoverageVNodes),
case UpdatedVNodes of
[] ->
- Mod:finish(clean, ModState);
+ Mod:finish(clean, UpdModState);
_ ->
{next_state,
waiting_results,
StateData#state{coverage_vnodes=UpdatedVNodes},
Timeout}
end;
- false -> % Ignore a response from a VNode that
- % is not part of the coverage plan
- {next_state,
- waiting_results,
- StateData#state{timeout=Timeout},
- Timeout}
+ UpdModState ->
+ UpdStateData = StateData#state{mod_state=UpdModState},
+ {next_state, waiting_results, UpdStateData, Timeout}
end;
-waiting_results({ReqId, Results},
- StateData=#state{coverage_vnodes=CoverageVNodes,
- mod=Mod,
- mod_state=ModState,
- req_id=ReqId,
- timeout=Timeout}) ->
- UpdModState = Mod:process_results(Results, CoverageVNodes, ModState),
- UpdStateData = StateData#state{mod_state=UpdModState},
- {next_state, waiting_results, UpdStateData, Timeout};
-waiting_results(timeout, #state{mod=Mod,
- mod_state=ModState}) ->
+waiting_results(timeout, #state{mod=Mod, mod_state=ModState}) ->
Mod:finish({error, timeout}, ModState).
%% @private

0 comments on commit 1807da6

Please sign in to comment.