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_db_listener.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/couchdb/couch_rep_db_listener.erl') diff --git a/src/couchdb/couch_rep_db_listener.erl b/src/couchdb/couch_rep_db_listener.erl index 5a5ab164..e4e8b246 100644 --- a/src/couchdb/couch_rep_db_listener.erl +++ b/src/couchdb/couch_rep_db_listener.erl @@ -156,7 +156,7 @@ process_change({Change}) -> true -> rep_doc_deleted(DocId); false -> - case couch_util:get_value(<<"state">>, RepProps) of + case couch_util:get_value(<<"_replication_state">>, RepProps) of <<"completed">> -> replication_complete(DocId); <<"error">> -> @@ -166,8 +166,8 @@ process_change({Change}) -> undefined -> maybe_start_replication(DocId, JsonRepDoc); _ -> - ?LOG_ERROR("Invalid value for the `state` property of the " - "replication document `~s`", [DocId]) + ?LOG_ERROR("Invalid value for the `_replication_state` property" + " of the replication document `~s`", [DocId]) end end, ok. @@ -201,13 +201,13 @@ maybe_start_replication(DocId, JsonRepDoc) -> maybe_tag_rep_doc(DocId, {Props} = JsonRepDoc, RepId, OtherDocId) -> - case couch_util:get_value(<<"replication_id">>, Props) of + case couch_util:get_value(<<"_replication_id">>, Props) of RepId -> ok; _ -> ?LOG_INFO("The replication specified by the document `~s` was already" " triggered by the document `~s`", [DocId, OtherDocId]), - couch_rep:update_rep_doc(JsonRepDoc, [{<<"replication_id">>, RepId}]) + couch_rep:update_rep_doc(JsonRepDoc, [{<<"_replication_id">>, RepId}]) end. @@ -222,11 +222,11 @@ start_replication({RepProps} = RepDoc, {Base, Ext} = RepId, UserCtx) -> couch_rep:update_rep_doc( RepDoc, [ - {<<"state">>, <<"error">>}, - {<<"replication_id">>, ?l2b(element(1, RepId))} + {<<"_replication_state">>, <<"error">>}, + {<<"_replication_id">>, ?l2b(Base)} ] ), - ?LOG_ERROR("Error starting replication ~p: ~p", [RepId, Error]) + ?LOG_ERROR("Error starting replication `~s`: ~p", [Base ++ Ext, Error]) end. rep_doc_deleted(DocId) -> -- cgit v1.2.3