summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shorin <kxepal@apache.org>2014-05-09 17:52:14 +0400
committerAlexander Shorin <kxepal@apache.org>2014-05-09 17:52:14 +0400
commite662802bc8d2ff4562220e7aaa6c28d54e3b8862 (patch)
treede7ce633334ba76bcbe8e0988371e899672d0b84
parent60be36097aa673e8e7b3cf230b6687f696867ae2 (diff)
downloadcouchdb-e662802bc8d2ff4562220e7aaa6c28d54e3b8862.tar.gz
Better Verify Peers section
-rw-r--r--share/doc/src/replication/protocol.rst73
1 files changed, 53 insertions, 20 deletions
diff --git a/share/doc/src/replication/protocol.rst b/share/doc/src/replication/protocol.rst
index 044228714..a0d40e18d 100644
--- a/share/doc/src/replication/protocol.rst
+++ b/share/doc/src/replication/protocol.rst
@@ -161,7 +161,7 @@ Verify Peers
' Verify Peers: '
' '
' 404 Not Found +---------------------------------+ '
- ' +------------------------- | Source Exists? | '
+ ' +------------------------- | Check Source Existence | '
' | +---------------------------------+ '
' | | HEAD /source | '
' | +---------------------------------+ '
@@ -169,7 +169,7 @@ Verify Peers
' | | 200 OK '
' | v '
' | +---------------------------------+ '
- ' | | Target Exists? | ---+ '
+ ' | | Check Target Existence | ---+ '
' | +---------------------------------+ | '
' | | HEAD /target | | '
' | +---------------------------------+ | '
@@ -201,7 +201,11 @@ Verify Peers
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
First of all, Replicator SHOULD ensure that both Source and Target are exists
-using :head:`/{db}` requests:
+by using :head:`/{db}` requests.
+
+
+Check Source Existence
+^^^^^^^^^^^^^^^^^^^^^^
**Request**:
@@ -223,6 +227,9 @@ using :head:`/{db}` requests:
Server: CouchDB (Erlang/OTP)
+Check Source Existence
+^^^^^^^^^^^^^^^^^^^^^^
+
**Request**:
.. code-block:: http
@@ -242,25 +249,11 @@ using :head:`/{db}` requests:
Date: Sat, 05 Oct 2013 08:51:11 GMT
Server: CouchDB (Erlang/OTP)
-In case of non-existed Source, Replication SHOULD be aborted with an HTTP error
-response:
- .. code-block:: http
-
- HTTP/1.1 500 Internal Server Error
- Cache-Control: must-revalidate
- Content-Length: 56
- Content-Type: application/json
- Date: Sat, 05 Oct 2013 08:55:29 GMT
- Server: CouchDB (Erlang OTP)
+May be Create Target?
+^^^^^^^^^^^^^^^^^^^^^
- {
- "error": "db_not_found",
- "reason": "could not open source"
- }
-
-
-In case of non-existed Target, Replicator MAY made additional :put:`/{db}`
+In case of non-existent Target, Replicator MAY made additional :put:`/{db}`
request to create the Target:
**Request**:
@@ -287,6 +280,46 @@ request to create the Target:
"ok": true
}
+However, Replicator MAY NOT succeeded on this operation due to insufficient
+privileges (which are granted by provided credential) and receiving
+:statuscode:`401` or :statuscode:`403` error SHOULD be expected and
+well handled:
+
+ .. code-block:: http
+
+ HTTP/1.1 500 Internal Server Error
+ Cache-Control: must-revalidate
+ Content-Length: 108
+ Content-Type: application/json
+ Date: Fri, 09 May 2014 13:50:32 GMT
+ Server: CouchDB (Erlang OTP)
+
+ {
+ "error": "unauthorized",
+ "reason": "unauthorized to access or create database http://localhost:5984/target"
+ }
+
+
+Abort
+^^^^^
+
+In case of non-existent Source or Target, Replication SHOULD be aborted with
+an HTTP error response:
+
+ .. code-block:: http
+
+ HTTP/1.1 500 Internal Server Error
+ Cache-Control: must-revalidate
+ Content-Length: 56
+ Content-Type: application/json
+ Date: Sat, 05 Oct 2013 08:55:29 GMT
+ Server: CouchDB (Erlang OTP)
+
+ {
+ "error": "db_not_found",
+ "reason": "could not open source"
+ }
+
Get Peers Information
---------------------