@InterfaceStability.Committed @InterfaceAudience.Public public class N1qlParams extends Object implements Serializable
queries
that allows to fluently set most of the N1QL query parameters:
- server side timeout
- client context ID
- scan consistency (with associated scan vector and/or scan wait if relevant)
- max parallelism
Note that these are different from statement-related named parameters or positional parameters.Modifier and Type | Method and Description |
---|---|
N1qlParams |
adhoc(boolean adhoc)
Allows to specify if this query is adhoc or not.
|
static N1qlParams |
build()
Start building a
N1qlParams , allowing to customize an N1QL request. |
String |
clientContextId()
Helper method to check if a client context ID is set.
|
N1qlParams |
consistency(ScanConsistency consistency)
Sets scan consistency.
|
N1qlParams |
consistentWith(Document... documents)
Sets the
Document s resulting of a mutation this query should be consistent with. |
N1qlParams |
consistentWith(DocumentFragment... fragments)
Sets the
DocumentFragment s resulting of a mutation this query should be consistent with. |
N1qlParams |
consistentWith(MutationState mutationState)
Sets the
MutationState this query should be consistent with. |
N1qlParams |
disableMetrics(boolean disableMetrics)
If set to true (false being the default), the metrics object will not be returned from N1QL and
as a result be more efficient.
|
static String |
durationToN1qlFormat(long duration,
TimeUnit unit)
Helper method to convert a duration into the n1ql (golang) format.
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
hasServerSideTimeout()
Helper method to check if a custom server side timeout has been applied on the params.
|
void |
injectParams(JsonObject queryJson)
Modifies the given N1QL query (as a
JsonObject ) to reflect these N1qlParams . |
boolean |
isAdhoc()
True if this query is adhoc, false otherwise.
|
N1qlParams |
maxParallelism(int maxParallelism)
Allows to override the default maximum parallelism for the query execution on the server side.
|
N1qlParams |
pipelineBatch(int pipelineBatch)
Advanced: Controls the number of items execution operators can batch for Fetch from the KV.
|
N1qlParams |
pipelineCap(int pipelineCap)
Advanced: Maximum number of items each execution operator can buffer between various operators.
|
N1qlParams |
pretty(boolean pretty)
If set to false, the server will be instructed to remove extra whitespace from the JSON response
in order to save bytes.
|
N1qlParams |
profile(N1qlProfile profile)
Specifies if there should be a profile section returned with the request results.
|
N1qlParams |
rawParam(String name,
Object value)
Allows to specify an arbitrary, raw N1QL param.
|
N1qlParams |
readonly(boolean readonly)
If set to true, it will signal the query engine on the server that only non-data modifying requests
are allowed.
|
N1qlParams |
scanCap(int scanCap)
Advanced: Maximum buffered channel size between the indexer client and the query service for index scans.
|
N1qlParams |
scanWait(long wait,
TimeUnit unit)
If the
NOT_BOUNDED scan consistency has been chosen, does nothing. |
N1qlParams |
serverSideTimeout(long timeout,
TimeUnit unit)
Sets a maximum timeout for processing on the server side.
|
String |
toString() |
N1qlParams |
withContextId(String clientContextId)
Adds a client context ID to the request, that will be sent back in the response, allowing clients
to meaningfully trace requests/responses when many are exchanged.
|
N1qlParams |
withCredentials(List<Credential> credentials)
Allows to add a list of credentials (in the form of
Credential objects) to this
request. |
N1qlParams |
withCredentials(String login,
String password)
Allows to add a credential username/password pair to this request.
|
public void injectParams(JsonObject queryJson)
JsonObject
) to reflect these N1qlParams
.queryJson
- the N1QL querypublic static String durationToN1qlFormat(long duration, TimeUnit unit)
public static N1qlParams build()
N1qlParams
, allowing to customize an N1QL request.N1qlParams
public N1qlParams serverSideTimeout(long timeout, TimeUnit unit)
timeout
- the duration of the timeout.unit
- the unit of the timeout, from nanoseconds to hours.N1qlParams
for chaining.public N1qlParams withContextId(String clientContextId)
clientContextId
- the client context ID (null to send none)N1qlParams
for chaining.public N1qlParams disableMetrics(boolean disableMetrics)
disableMetrics
- true if disabled, false otherwise (false = default).N1qlParams
for chaining.public N1qlParams consistency(ScanConsistency consistency)
NOT_BOUNDED
will unset the scanWait
if it was set.N1qlParams
for chaining.@InterfaceStability.Committed public N1qlParams consistentWith(Document... documents)
Document
s resulting of a mutation this query should be consistent with.documents
- the documents returned from a mutation.N1qlParams
for chaining.@InterfaceStability.Committed public N1qlParams consistentWith(DocumentFragment... fragments)
DocumentFragment
s resulting of a mutation this query should be consistent with.fragments
- the fragments returned from a mutation.N1qlParams
for chaining.@InterfaceStability.Committed public N1qlParams consistentWith(MutationState mutationState)
MutationState
this query should be consistent with.mutationState
- the mutation state which accumulates tokens from one or more mutation results.N1qlParams
for chaining.public N1qlParams scanWait(long wait, TimeUnit unit)
NOT_BOUNDED scan consistency
has been chosen, does nothing.
Otherwise, sets the maximum time the client is willing to wait for an index to catch up to the
vector timestamp in the request.wait
- the duration.unit
- the unit for the duration.N1qlParams
for chaining.public N1qlParams maxParallelism(int maxParallelism)
maxParallelism
- the maximum parallelism for this query, 0 or negative values disable it.N1qlParams
for chaining.public N1qlParams adhoc(boolean adhoc)
adhoc
- if the query is adhoc, default is true (plain execution).N1qlParams
for chaining.public N1qlParams withCredentials(List<Credential> credentials)
Credential
objects) to this
request. Credentials for usernames that were previously set by a similar call are replaced.credentials
- the list of credentials to add to the request.N1qlParams
for chaining.public N1qlParams withCredentials(String login, String password)
login
- the username/bucketname to add a credential for.password
- the associated password.N1qlParams
for chaining.public N1qlParams pretty(boolean pretty)
pretty
- if set to false, pretty responses are disabled.N1qlParams
for chaining.public N1qlParams readonly(boolean readonly)
readonly
- true if readonly should be forced, false is the default and will use the server side default.N1qlParams
for chaining.public N1qlParams scanCap(int scanCap)
scanCap
- the scan_cap param, use 0 or negative number to disable.N1qlParams
for chaining.public N1qlParams pipelineBatch(int pipelineBatch)
pipelineBatch
- the pipeline_batch param.N1qlParams
for chaining.public N1qlParams pipelineCap(int pipelineCap)
pipelineCap
- the pipeline_cap param.N1qlParams
for chaining.@InterfaceStability.Uncommitted public N1qlParams profile(N1qlProfile profile)
profile
- the profile param N1qlProfile
.N1qlParams
for chaining.@InterfaceStability.Uncommitted public N1qlParams rawParam(String name, Object value)
N1qlParams
class.name
- the name of the property.value
- the value of the property, only JSON value types are supported.N1qlParams
for chaining.public boolean hasServerSideTimeout()
public String clientContextId()
public boolean isAdhoc()
Copyright © 2015 Couchbase, Inc.