anchor.diff:  has_valid_rep_id(_Else) ->
       true.
   
  +process_change(stop_all_replications) ->
  +    ?LOG_INFO("Stopping all ongoing replications because the replicator DB "
  +        "was deleted or changed", []),
  +    stop_all_replications();
   
   process_change({Change}) ->
       {RepProps} = JsonRepDoc = couch_util:get_value(doc, Change),
  
positive.code:     Server = self(),
      ok = couch_config:register(
          fun("replicator", "db") ->
              ok = gen_server:call(Server, rep_db_changed, infinity)
          end
      ),
      {ok, #state{
          changes_feed_loop = Loop,
          changes_queue = Queue,
          changes_processor = Processor}
      }.
  
  handle_call(rep_db_changed, _From, State) ->
      #state{
          changes_feed_loop = Loop,
          changes_queue = Queue
      } = State,
      exit(Loop, rep_db_changed),
      {ok, NewLoop} = changes_feed_loop(Queue),
      {reply, ok, State#state{changes_feed_loop = NewLoop}}.
  
  
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
  
  handle_info({'EXIT', _OldChangesLoop, rep_db_changed}, State) ->
      {noreply, State};
  
  handle_info({'EXIT', From, Reason}, #state{changes_processor = From} = State) ->
      ?LOG_ERROR("Replicator DB changes processor died. Reason: ~p", [Reason]),
      {stop, rep_db_changes_processor_error, State}.
  
  
  terminate(_Reason, State) ->
  
negative.code:     [] ->
          none
      end.
  
  stop_all_replications() ->
      ets:foldl(
          fun({_, RepId}, _) -> couch_rep:end_replication(RepId) end,
          ok,
          ?DOC_TO_REP_ID_MAP
      ),
      true = ets:delete_all_objects(?REP_ID_TO_DOC_ID_MAP),
      true = ets:delete_all_objects(?DOC_TO_REP_ID_MAP).
  