docs(api): updated examples and description of CAS and CAD

This commit is contained in:
Mikhail Goncharov 2014-03-12 09:33:47 +07:00
parent ac872b3855
commit b8f59340af

View File

@ -437,14 +437,15 @@ This will try to compare the previous value of the key and the previous value we
```json ```json
{ {
"cause": "[two != one] [0 != 8]", "cause": "[two != one]",
"errorCode": 101, "errorCode": 101,
"index": 8, "index": 8,
"message": "Test Failed" "message": "Test Failed"
} }
``` ```
which means `CompareAndSwap` failed. which means `CompareAndSwap` failed. `cause` explains why the test failed.
Note: the condition prevIndex=0 always passes.
Let's try a valid condition: Let's try a valid condition:
@ -503,7 +504,7 @@ The error code explains the problem:
{ {
"errorCode": 101, "errorCode": 101,
"message": "Compare failed", "message": "Compare failed",
"cause": "[two != one] [0 != 8]", "cause": "[two != one]",
"index": 8 "index": 8
} }
``` ```
@ -518,7 +519,7 @@ curl -L http://127.0.0.1:4001/v2/keys/foo?prevIndex=1 -XDELETE
{ {
"errorCode": 101, "errorCode": 101,
"message": "Compare failed", "message": "Compare failed",
"cause": "[ != one] [1 != 8]", "cause": "[1 != 8]",
"index": 8 "index": 8
} }
``` ```