summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_rep.erl
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-11-23 15:50:26 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-11-23 15:50:26 +0000
commit5dcc10a9ad8b180431bee49cc1b36a8f0859ff71 (patch)
tree9014fbe569ae9af2c3ad91027a1729ecafe79e8a /src/couchdb/couch_rep.erl
parent1b07ac052dd87d5dd255ebc328e9b8e66fac21c5 (diff)
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
Diffstat (limited to 'src/couchdb/couch_rep.erl')
-rw-r--r--src/couchdb/couch_rep.erl15
1 files changed, 9 insertions, 6 deletions
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.