DESCRIPTION

JVMCBC-273: Implement sub-document protocol in core

Motivation:
-----------
Subdocument is a feature in development that allows to read and mutate
values deep inside a JSON document, without paying the extra cost of
retrieving the whole document.

Modifications:
--------------
All subdocument operations have been implemented at the protocol level.
All subdocument status have now also a corresponding ResponseStatus.

The KeyValueHandler is able to encode and decode subdocument requests
and responses.

Messages for single operations (GET, EXIST, DICT_ADD, DICT_UPSERT,
DELETE, REPLACE, COUNTER) and array ops (PUSH_FIRST, PUSH_LAST, INSERT,
ADD_UNIQUE) have been added to the message.kv.subdoc.simple package.

Messages for multi-operations (performing several lookups or several
mutations in an atomic fashion inside a single document) have been added
to the message.kv.subdoc.multi package.

The protocol messages are tested in the SubdocumentMessageTest testcase.

Result:
-------
The core layer of the Java SDK is ready for SubDocument feature.

Change-Id: Ib8f3a081dee85ffc9ffcacb3d973bb77789db4ea


COMMENTS

author: Estrella Humphrey
date: 2015-12-23 19:24:16.689000000

Uploaded patch set 9.

-------------------------------------
author: Estrella Humphrey
date: 2015-12-23 19:24:56.974000000

Patch Set 9: -Code-Review Verified+1

this last patchset adds MULTI operations (lookup and mutations).
it's like Christmas!!

-------------------------------------
author: Wyatt Kramer
date: 2015-12-23 20:14:30.199000000

Patch Set 9:

For tests, I would suggest you build the expected JSON equivalent rather than assuming that the string will remain the same. Subdoc makes no guarantee on *how* the JSON will look like after the mutation; for example added/removed whitespace, etc.

-------------------------------------
author: Wyatt Kramer
date: 2015-12-23 20:28:30.558000000

Patch Set 9:

(7 comments)

Some checks for empty paths missing; in addition you should actually add tests to ensure empty paths (where not allowed; i.e. everything except PUSH_* and ADDUNIQUE) result in a client-side error rather than a cryptic server-side EINVAL

Line:53, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubReplaceRequest.java -> Check empty path

Line:54, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubCounterRequest.java -> Check empty path (illegal!)

Line:48, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubExistRequest.java -> Check empty path (illegal)

Line:55, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubArrayRequest.java -> Check empty path on INSERT (illegal!)

Line:64, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubDictUpsertRequest.java -> Check empty path (lllegal)

Line:51, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubDictAddRequest.java -> Check empty path (illegal!)

Line:48, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubGetRequest.java -> Check empty path

-------------------------------------
author: Estrella Humphrey
date: 2016-01-04 08:26:07.044000000

Patch Set 9:

(7 comments)

Line:53, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubReplaceRequest.java -> Done

Line:54, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubCounterRequest.java -> Done

Line:48, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubExistRequest.java -> Done

Line:55, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubArrayRequest.java -> Done

Line:64, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubDictUpsertRequest.java -> Done

Line:51, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubDictAddRequest.java -> Done

Line:48, src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/SubGetRequest.java -> Done

-------------------------------------
author: Gerrit Code Review
date: 2016-01-04 10:27:50.762000000

Change has been successfully cherry-picked as 128d07550339126fb79539556296de5640d676b2

-------------------------------------
