anchor.diff:              maybe_start_replication(State, DocId, JsonRepDoc);
           <<"triggered">> ->
               maybe_start_replication(State, DocId, JsonRepDoc);
  -        _ ->
  -           State
  +        <<"completed">> ->
  +            replication_complete(DocId),
  +            State;
  +        <<"error">> ->
  +            replication_error(State, DocId)
           end
       end.
   
  
positive.code:     end.
  
  
  start_replication(Server, #rep{id = RepId, doc_id = DocId} = Rep, Wait) ->
      ok = timer:sleep(Wait * 1000),
      case (catch couch_replicator:async_replicate(Rep)) of
      {ok, _} ->
          ok = gen_server:call(Server, {rep_started, RepId}, infinity),
          ?LOG_INFO("Document `~s` triggered replication `~s`",
              [DocId, pp_rep_id(RepId)]);
      Error ->
          ok = gen_server:call(Server, {rep_error, RepId, Error}, infinity)
      end.
  
  
  
negative.code: update_rep_doc(RepDocId, KVs) ->
      {ok, RepDb} = ensure_rep_db_exists(),
      try
          case couch_db:open_doc(RepDb, RepDocId, []) of
          {ok, LatestRepDoc} ->
              update_rep_doc(RepDb, LatestRepDoc, KVs);
          _ ->
              ok
          end
      catch throw:conflict ->
          % Shouldn't happen, as by default only the role _replicator can
          % update replication documents.
  