4444-record (state , {bucket :: bucket_name () | undefined ,
4545 buckets_count :: pos_integer (),
4646 bucket_number :: non_neg_integer (),
47- progress :: rebalance_progress :progress (),
47+ stage_info :: rebalance_progress :stage_info (),
4848 nodes_info :: [{atom (), [node ()]}],
4949 type :: atom (),
5050 done_moves :: [# move_state {}],
5151 current_moves :: [# move_state {}],
5252 pending_moves :: [# move_state {}]
5353 }).
5454
55- start_link (Services , NodesInfo , Type ) ->
56- gen_server :start_link (? SERVER , ? MODULE , {Services , NodesInfo , Type }, []).
55+ start_link (Stages , NodesInfo , Type ) ->
56+ gen_server :start_link (? SERVER , ? MODULE , {Stages , NodesInfo , Type }, []).
5757
5858generic_get_call (Call ) ->
5959 generic_get_call (Call , 10000 ).
@@ -71,8 +71,8 @@ get_detailed_progress() ->
7171get_aggregated_progress (Timeout ) ->
7272 generic_get_call (get_aggregated_progress , Timeout ).
7373
74- update_progress (Service , ServiceProgress ) ->
75- gen_server :cast (? SERVER , {update_progress , Service , ServiceProgress }).
74+ update_progress (Stage , StageProgress ) ->
75+ gen_server :cast (? SERVER , {update_progress , Stage , StageProgress }).
7676
7777is_interesting_master_event ({_ , bucket_rebalance_started , _Bucket , _Pid }) ->
7878 fun handle_bucket_rebalance_started /2 ;
@@ -85,7 +85,7 @@ is_interesting_master_event({_, vbucket_move_done, _BucketName, _VBucketId}) ->
8585is_interesting_master_event (_ ) ->
8686 undefined .
8787
88- init ({Services , NodesInfo , Type }) ->
88+ init ({Stages , NodesInfo , Type }) ->
8989 Self = self (),
9090 ns_pubsub :subscribe_link (master_activity_events ,
9191 fun (Event , _Ignored ) ->
@@ -98,14 +98,14 @@ init({Services, NodesInfo, Type}) ->
9898 end , []),
9999
100100 {active_nodes , ActiveNodes } = lists :keyfind (active_nodes , 1 , NodesInfo ),
101- Progress = rebalance_progress :init (ActiveNodes , Services ),
101+ StageInfo = rebalance_stage_info :init (ActiveNodes , Stages ),
102102 BucketsCount = length (ns_bucket :get_buckets ()),
103103 proc_lib :spawn_link (erlang , apply , [fun docs_left_updater_init /1 , [Self ]]),
104104
105105 {ok , # state {bucket = undefined ,
106106 buckets_count = BucketsCount ,
107107 bucket_number = 0 ,
108- progress = Progress ,
108+ stage_info = StageInfo ,
109109 nodes_info = NodesInfo ,
110110 type = Type ,
111111 done_moves = [],
@@ -117,8 +117,8 @@ handle_call(get, _From, State) ->
117117handle_call (get_detailed_progress , _From , State ) ->
118118 {reply , do_get_detailed_progress (State ), State };
119119handle_call (get_aggregated_progress , _From ,
120- # state {progress = Progress } = State ) ->
121- {reply , dict :to_list (rebalance_progress :get_progress (Progress )), State };
120+ # state {stage_info = StageInfo } = State ) ->
121+ {reply , dict :to_list (rebalance_stage_info :get_progress (StageInfo )), State };
122122handle_call (Req , From , State ) ->
123123 ? log_error (" Got unknown request: ~p from ~p " , [Req , From ]),
124124 {reply , unknown_request , State }.
@@ -172,10 +172,11 @@ handle_cast({update_stats, VBucket, NodeToDocsLeft}, State) ->
172172 Move # move_state {stats = NewStats }
173173 end )};
174174
175- handle_cast ({update_progress , Service , ServiceProgress },
176- # state {progress = Old } = State ) ->
177- NewProgress = rebalance_progress :update (Service , ServiceProgress , Old ),
178- {noreply , State # state {progress = NewProgress }};
175+ handle_cast ({update_progress , Stage , StageProgress },
176+ # state {stage_info = Old } = State ) ->
177+ NewStageInfo = rebalance_stage_info :update_progress (
178+ Stage , StageProgress , Old ),
179+ {noreply , State # state {stage_info = NewStageInfo }};
179180
180181handle_cast (Req , _State ) ->
181182 ? log_error (" Got unknown cast: ~p " , [Req ]),
0 commit comments