DESCRIPTION

JCBC-851: Cluster Level Querying

Motivation:
-----------
Breaking from the historical model of data manipulation at the bucket
level, N1QL allows to perform JOINS over multiple buckets.

Even though it *is* technically possible to perform such a query from
a Bucket (by making sure that all relevant credentials other than the
ones for the root bucket are provided in the N1qlQuery), it is a bit
counterintuitive.

Cluster-level querying aims at providing a more intuitive way of doing
such bucket-spanning queries.

Note that the configuration and resource management of the SDK makes it
so that performing a N1QL query still has the prerequisite that a
bucket is currently opened in the Cluster.

Modifications:
--------------
Mirrored the query API from Bucket/AsyncBucket to Cluster/AsyncCluster.

The sync version delegates to the AsyncCluster, while the async version
attempts to find an open AsyncBucket and delegate the execution of the
query to it.
The query is enriched with the credentials taken from the currently
configured Authenticator.

The function that allows to go from an AsyncN1qlQueryResult to a sync
one has been extracted in N1qlQueryExecutor. It is reused by the query
implementation in CouchbaseCluster.

Results:
--------
N1QL queries spanning multiple buckets (including password protected
ones) can be more intuitively performed from the Cluster/AsyncCluster.

This functionality and its specific error condition (no open bucket)
are tested in an integration test.

Change-Id: I4001c492a7829f713fe6bc98945a19102d9e9da1


COMMENTS

author: Estrella Humphrey
date: 2016-09-13 14:48:47.978000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2016-09-13 14:53:16.420000000

Patch Set 1: Verified+1

-------------------------------------
author: Tate Garrett
date: 2016-09-20 09:05:26.801000000

Change has been successfully cherry-picked as 2a4f66d2eb4a89e461fb0dd839d60b10a28c0028 by Estrella Humphrey

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