Couchbase C++ SDK 1.0.2 (rev. 51f4775)
|
Options for cluster::analytics_query() and scope::analytics_query(). More...
#include <couchbase/analytics_options.hxx>
Classes | |
struct | built |
Immutable value object representing consistent options. More... | |
Public Member Functions | |
auto | build () const -> built |
Validates options and returns them as an immutable value. | |
auto | priority (bool prioritized) -> analytics_options & |
Allows to give certain requests higher priority than others. | |
auto | readonly (bool readonly) -> analytics_options & |
Allows explicitly marking a query as being readonly and not mutating and documents on the server side. | |
auto | scan_wait (std::chrono::milliseconds wait) -> analytics_options & |
Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query. | |
auto | client_context_id (std::string client_context_id) -> analytics_options & |
Supports providing a custom client context ID for this query. | |
auto | scan_consistency (analytics_scan_consistency scan_consistency) -> analytics_options & |
Customizes the consistency guarantees for this query. | |
auto | consistent_with (const mutation_state &state) -> analytics_options & |
Sets the mutation_token s this query should be consistent with. | |
template<typename Serializer = codec::tao_json_serializer, typename Value , std::enable_if_t< codec::is_serializer_v< Serializer >, bool > = true> | |
auto | raw (std::string name, const Value &value) -> analytics_options & |
template<typename Serializer = codec::tao_json_serializer, typename... Parameters, std::enable_if_t< codec::is_serializer_v< Serializer >, bool > = true> | |
auto | positional_parameters (const Parameters &... parameters) -> analytics_options & |
Set list of positional parameters for a query. | |
template<typename Serializer = codec::tao_json_serializer, typename... Parameters, std::enable_if_t< codec::is_serializer_v< Serializer >, bool > = true> | |
auto | named_parameters (const Parameters &... parameters) -> analytics_options & |
Set list of named parameters for a query. | |
auto | encoded_raw_options (std::map< std::string, codec::binary, std::less<> > options) -> analytics_options & |
Set map of raw options for a query. | |
auto | encoded_positional_parameters (std::vector< codec::binary > parameters) -> analytics_options & |
Set list of positional parameters for a query. | |
auto | encoded_named_parameters (std::map< std::string, codec::binary, std::less<> > parameters) -> analytics_options & |
Set map of named parameters for a query. | |
Public Member Functions inherited from common_options< analytics_options > | |
auto | timeout (const std::chrono::milliseconds timeout) -> analytics_options & |
Specifies a custom per-operation timeout. | |
auto | retry_strategy (const std::shared_ptr< retry_strategy > strategy) -> analytics_options & |
Specifies a custom couchbase::retry_strategy for this operation. | |
Additional Inherited Members | |
Protected Member Functions inherited from common_options< analytics_options > | |
auto | build_common_options () const -> built |
auto | self () -> analytics_options & |
Allows to return the right options builder instance for child implementations. | |
Options for cluster::analytics_query() and scope::analytics_query().
|
inlinenodiscard |
Validates options and returns them as an immutable value.
std::system_error | with code errc::common::invalid_argument if the options are not valid |
|
inline |
Supports providing a custom client context ID for this query.
If no client context ID is provided by the user, a UUID is generated and sent automatically so by default it is always possible to identify a query when debugging.
client_context_id | the client context ID |
|
inline |
Sets the mutation_token
s this query should be consistent with.
These mutation tokens are returned from mutations (i.e. as part of a mutation_result
) and if you want your N1QL query to include those you need to pass the mutation tokens into a mutation_state
.
Note that you cannot use this method and scan_consistency(analytics_scan_consistency)
at the same time, since they are mutually exclusive. As a rule of thumb, if you only care to be consistent with the mutation you just wrote on the same thread/app, use this method. If you need "global" scan consistency, use analytics_scan_consistency#request_plus
on scan_consistency(analytics_scan_consistency)
.
state | the mutation state containing the mutation tokens. |
|
inline |
Set map of named parameters for a query.
This function expects that all parameters encoded into pairs containing mapping names of the parameter to valid JSON values encoded as string.
parameters | mapping of pairs, where each entry contains string with valid JSON value. |
|
inline |
Set list of positional parameters for a query.
This function expects that all parameters encoded into byte strings containing valid JSON values.
parameters | vector of binaries, where each entry contains string with valid JSON value. |
|
inline |
Set map of raw options for a query.
This function expects that all parameters encoded into pairs containing mapping names of the parameter to valid JSON values encoded as string.
options | mapping of pairs, where each entry contains string with valid JSON value. |
|
inline |
Set list of named parameters for a query.
Parameters | types for the parameter pairs |
parameters | the sequence of name-value pairs. Each value will be encoded into JSON. |
|
inline |
Set list of positional parameters for a query.
Parameters | types for the parameters |
parameters | the sequence of positional parameters. Each entry will be encoded into JSON. |
|
inline |
Allows to give certain requests higher priority than others.
prioritized | if set to true this query will be treated with a higher priority by the service. |
|
inline |
Value |
name | |
value |
|
inline |
Allows explicitly marking a query as being readonly and not mutating and documents on the server side.
In addition to providing some security in that you are not accidentally modifying data, setting this flag to true also helps the client to more proactively retry and re-dispatch a query since then it can be sure it is idempotent. As a result, if your query is readonly then it is a good idea to set this flag.
readonly | true if readonly should be set, false is the default and will use the server side default. |
|
inline |
Customizes the consistency guarantees for this query.
Tuning the scan consistency allows to trade data "freshness" for latency and vice versa. By default analytics_scan_consistency::not_bounded
is used, which means that the server returns the data it has in the index right away. This is fast, but might not include the most recent mutations. If you want to include all the mutations up to the point of the query, use analytics_scan_consistency::request_plus
.
Note that you cannot use this method and consistent_with(const mutation_state&)
at the same time, since they are mutually exclusive. As a rule of thumb, if you only care to be consistent with the mutation you just wrote on the same thread/app, use consistent_with(const mutation_state&)
. If you need "global" scan consistency, use analytics_scan_consistency::request_plus
on this method.
scan_consistency | the index scan consistency to be used for this query |
|
inline |
Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.
analytics_scan_consistency::not_bounded
is used, this method doesn't do anything at all. If no value is provided to this method, the server default is used.wait | the maximum duration the query engine is willing to wait before failing. |