From 5dcc10a9ad8b180431bee49cc1b36a8f0859ff71 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Tue, 23 Nov 2010 15:50:26 +0000 Subject: Merged revision 1038172 from trunk: Replicator DB: added underscore prefix to the replication document fields that are meant to to be set/updated only by the replicator. This makes it more clear to end users that those fields are meant to be used internally by CouchDB. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1038173 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep.erl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/couchdb/couch_rep.erl') diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 8eaa99ee..663fd838 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -263,12 +263,14 @@ handle_info({'EXIT', _Pid, Reason}, State) -> terminate(normal, #state{checkpoint_scheduled=nil} = State) -> do_terminate(State), - update_rep_doc(State#state.rep_doc, [{<<"state">>, <<"completed">>}]); + update_rep_doc( + State#state.rep_doc, [{<<"_replication_state">>, <<"completed">>}]); terminate(normal, State) -> timer:cancel(State#state.checkpoint_scheduled), do_terminate(do_checkpoint(State)), - update_rep_doc(State#state.rep_doc, [{<<"state">>, <<"completed">>}]); + update_rep_doc( + State#state.rep_doc, [{<<"_replication_state">>, <<"completed">>}]); terminate(shutdown, #state{listeners = Listeners} = State) -> % continuous replication stopped @@ -278,7 +280,8 @@ terminate(shutdown, #state{listeners = Listeners} = State) -> terminate(Reason, #state{listeners = Listeners} = State) -> [gen_server:reply(L, {error, Reason}) || L <- Listeners], terminate_cleanup(State), - update_rep_doc(State#state.rep_doc, [{<<"state">>, <<"error">>}]). + update_rep_doc( + State#state.rep_doc, [{<<"_replication_state">>, <<"error">>}]). code_change(_OldVsn, State, _Extra) -> {ok, State}. @@ -866,15 +869,15 @@ update_rep_doc(RepDb, #doc{body = {RepDocBody}} = RepDoc, KVs) -> ). maybe_set_triggered({RepProps} = RepDoc, RepId) -> - case couch_util:get_value(<<"state">>, RepProps) of + case couch_util:get_value(<<"_replication_state">>, RepProps) of <<"triggered">> -> ok; _ -> update_rep_doc( RepDoc, [ - {<<"state">>, <<"triggered">>}, - {<<"replication_id">>, ?l2b(RepId)} + {<<"_replication_state">>, <<"triggered">>}, + {<<"_replication_id">>, ?l2b(RepId)} ] ) end. -- cgit v1.2.3