anchor.diff:           delete_bucket/1,
            failover/1,
            needs_rebalance/0,
  +         request_janitor_run/1,
            rebalance_progress/0,
            start_link/0,
            start_rebalance/3,
  
positive.code:             not_running
      end.
  
  
  -spec start_rebalance([node()], [node()], [node()]) ->
                               ok | in_progress | already_balanced.
  
negative.code: %%
  
  %% Asynchronous idle events
  idle({request_janitor_run, BucketName}, State) ->
      RemainingBuckets =State#idle_state.remaining_buckets,
      case lists:member(BucketName, RemainingBuckets) of
          false ->
              self() ! janitor,
              {next_state, idle, State#idle_state{remaining_buckets = [BucketName|RemainingBuckets]}};
          _ ->
              {next_state, idle, State}
      end;
  idle(_Event, State) ->
      %% This will catch stray progress messages
      {next_state, idle, State}.
  
  janitor_running({request_janitor_run, BucketName}, State) ->
      RemainingBuckets =State#janitor_state.remaining_buckets,
      case lists:member(BucketName, RemainingBuckets) of
          false ->
              {next_state, janitor_running, State#idle_state{remaining_buckets = [BucketName|RemainingBuckets]}};
          _ ->
              {next_state, janitor_running, State}
      end;
  janitor_running(_Event, State) ->
      {next_state, janitor_running, State}.
  
  