DESCRIPTION

wip subdoc v2

all operations except multi lookup throw on most errors

PATH_NOT_FOUND is treated specially:
single get doesn't throw but content null
single exists doesn't throw but content false
multi get's content is null for PATH_NOT_FOUND, while multi exists is false (but in both case, DocumentFragment.exists returns false since it detects the error)

Change-Id: I0038af9b543464832a15cd204dad20c83ab745eb


COMMENTS

author: Estrella Humphrey
date: 2016-02-19 13:16:14.956000000

Uploaded patch set 3.

-------------------------------------
author: Estrella Humphrey
date: 2016-02-19 13:16:50.424000000

Patch Set 3: Verified+1

need to flesh out the commit comment and maybe clarify various error conditions

-------------------------------------
author: Natasha Sullivan
date: 2016-02-19 14:38:51.740000000

Patch Set 3:

(19 comments)

Line:45, src/main/java/com/couchbase/client/java/subdoc/MutationSpec.java -> todo?

Line:259, src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java -> same createParents overloads comment as on the blocking builder

Line:486, src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java -> I wonder if it makes it cleaner if those options down here are moved into separated classes each? But I'm good if we do it in a later changeset

Line:226, src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java -> I think it makes sense to have an overload with createParents = true

Line:238, src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java -> I think it makes sense to have an overload with createParents = true

Line:263, src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java -> I think it makes sense to have an overload with createParents = true

Line:277, src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java -> I think it makes sense to have an overload with createParents = true

Line:303, src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java -> I think it makes sense to have an overload with createParents = true

Line:218, src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java -> that is a heavy callback - can we move that into a helper class? might be also better to inline for the jvm...

Line:301, src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java -> can this be private?

Line:93, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> those getters on the class need some javadoc love - will be used a lot!

Line:130, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> is that part of the spec/ what benefit does it bring to have the ResponseStatus accessible? IIRC we don't expose that in other cases?

Line:165, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> todo

Line:88, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> is that something we can automate better? looks weird to have it like this in here .. or is pending cleanup?

Line:160, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> shouldn't this throw an exception? or how would the badPath null case be distinguished from badPath existing in the doc but "badPath": null ?

Line:437, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> private?

Line:550, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> WS

Line:2021, src/main/java/com/couchbase/client/java/AsyncBucket.java -> want to get rid of that stuff and add 2 docblocks to the new methods?

Line:4425, src/main/java/com/couchbase/client/java/Bucket.java -> want to get rid of that stuff and add 2 docblocks to the new methods?

-------------------------------------
author: Estrella Humphrey
date: 2016-02-19 16:41:17.504000000

Patch Set 3:

(14 comments)

Line:45, src/main/java/com/couchbase/client/java/subdoc/MutationSpec.java -> Actually yes I'm thinking about leaving this there for now, since on the write path anything that Jackson can serialize is actually legit JSON (and it would be difficult to represent a raw JSON string like in other APIs)
Maybe something to be improved on later?

Line:259, src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java -> deferred for now, this would have to be part of the spec I guess and could go either way?

Line:486, src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java -> yeah let's clean that up in another changeset if it becomes a problem

Line:218, src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java -> I'll extract it in its own constant, we can see later if it needs to be extracted in another class

Line:301, src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java -> Done

Line:93, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> Done

Line:130, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> I was proposing that as an improvement. To me it can make sense to have a way of checking what the error was without catching the exception and instanceofing it... that said a result with an error in it is rare enough (only in multi lookups)

Line:165, src/main/java/com/couchbase/client/java/subdoc/DocumentFragment.java -> Done

Line:88, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> to be cleaned up

Line:160, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> it can be distinguished by checking the exists(path) or status(path) method instead of content(path)... that said I'm still quite unclear (from the spec) if that's the best way to represent that... for instance, lookupIn.exist() only ever returning true or an exception doesn't make much sense, so get and exist consider a bad path as an "semi-error" to be represented differently, I'd say

Line:437, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> Done

Line:550, src/integration/java/com/couchbase/client/java/SubDocumentTest.java -> Done

Line:2021, src/main/java/com/couchbase/client/java/AsyncBucket.java -> Done

Line:4425, src/main/java/com/couchbase/client/java/Bucket.java -> Done

-------------------------------------
author: Tate Garrett
date: 2016-02-23 18:39:14.344000000

Change has been successfully cherry-picked as 8ccf14088a27669ff29852cf88cd37b2eb471611

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