Class: Couchbase::Cluster::QueryOptions
- Inherits:
-
Object
- Object
- Couchbase::Cluster::QueryOptions
- Defined in:
- lib/couchbase/query_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/query_options.rb more...
Instance Attribute Summary collapse
-
#adhoc ⇒ Boolean
Allows turning this request into a prepared statement query.
-
#client_context_id ⇒ String
Provides a custom client context ID for this query.
-
#max_parallelism ⇒ Integer
Allows overriding the default maximum parallelism for the query execution on the server side.
-
#metrics ⇒ Boolean
Enables per-request metrics in the trailing section of the query.
-
#pipeline_batch ⇒ Integer
Supports customizing the number of items execution operators can batch for fetch from the KV layer on the server.
-
#pipeline_cap ⇒ Integer
Allows customizing the maximum number of items each execution operator can buffer between various operators on the server.
-
#profile ⇒ :off, ...
Customize server profile level for this query.
-
#readonly ⇒ Boolean
Allows explicitly marking a query as being readonly and not mutating any documents on the server side.
-
#scan_cap ⇒ Integer
Supports customizing the maximum buffered channel size between the indexer and the query service.
- #scan_consistency ⇒ :not_bounded, :request_plus
-
#scan_wait ⇒ Integer
Allows customizing how long (in milliseconds) the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.
-
#scope_qualifier ⇒ String
Associate scope qualifier (also known as
query_context
) with the query. -
#timeout ⇒ Integer
Timeout in milliseconds.
Instance Method Summary collapse
-
#consistent_with(mutation_state) ⇒ Object
Sets the mutation tokens this query should be consistent with.
-
#initialize {|self| ... } ⇒ QueryOptions
constructor
A new instance of QueryOptions.
-
#named_parameters(named) ⇒ Object
Sets named parameters for the query.
-
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query.
-
#raw(key, value) ⇒ Object
Allows providing custom JSON key/value pairs for advanced usage.
Constructor Details
#initialize {|self| ... } ⇒ QueryOptions
Returns a new instance of QueryOptions.
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/couchbase/query_options.rb', line 80 def initialize @timeout = 75_000 # ms @adhoc = true @raw_parameters = {} @positional_parameters = nil @named_parameters = nil @scan_consistency = nil @mutation_state = nil @scope_qualifier = nil yield self if block_given? end |
Instance Attribute Details
#adhoc ⇒ Boolean
Returns Allows turning this request into a prepared statement query.
24 25 26 |
# File 'lib/couchbase/query_options.rb', line 24 def adhoc @adhoc end |
#client_context_id ⇒ String
Returns Provides a custom client context ID for this query.
27 28 29 |
# File 'lib/couchbase/query_options.rb', line 27 def client_context_id @client_context_id end |
#max_parallelism ⇒ Integer
Returns Allows overriding the default maximum parallelism for the query execution on the server side.
30 31 32 |
# File 'lib/couchbase/query_options.rb', line 30 def max_parallelism @max_parallelism end |
#metrics ⇒ Boolean
Returns Enables per-request metrics in the trailing section of the query.
55 56 57 |
# File 'lib/couchbase/query_options.rb', line 55 def metrics @metrics end |
#pipeline_batch ⇒ Integer
Returns Supports customizing the number of items execution operators can batch for fetch from the KV layer on the server.
48 49 50 |
# File 'lib/couchbase/query_options.rb', line 48 def pipeline_batch @pipeline_batch end |
#pipeline_cap ⇒ Integer
Returns Allows customizing the maximum number of items each execution operator can buffer between various operators on the server.
52 53 54 |
# File 'lib/couchbase/query_options.rb', line 52 def pipeline_cap @pipeline_cap end |
#profile ⇒ :off, ...
Returns Customize server profile level for this query.
58 59 60 |
# File 'lib/couchbase/query_options.rb', line 58 def profile @profile end |
#readonly ⇒ Boolean
Returns Allows explicitly marking a query as being readonly and not mutating any documents on the server side.
33 34 35 |
# File 'lib/couchbase/query_options.rb', line 33 def readonly @readonly end |
#scan_cap ⇒ Integer
Returns Supports customizing the maximum buffered channel size between the indexer and the query service.
45 46 47 |
# File 'lib/couchbase/query_options.rb', line 45 def scan_cap @scan_cap end |
#scan_consistency ⇒ :not_bounded, :request_plus
69 70 71 |
# File 'lib/couchbase/query_options.rb', line 69 def scan_consistency @scan_consistency end |
#scan_wait ⇒ Integer
that if :not_bounded
consistency level is used, this method doesn’t do anything
Allows customizing how long (in milliseconds) the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.
at all. If no value is provided to this method, the server default is used.
42 43 44 |
# File 'lib/couchbase/query_options.rb', line 42 def scan_wait @scan_wait end |
#scope_qualifier ⇒ String
Associate scope qualifier (also known as query_context
) with the query.
The qualifier must be in form {bucket_name}.{scope_name} or default:{bucket_name}.{scope_name}.
66 67 68 |
# File 'lib/couchbase/query_options.rb', line 66 def scope_qualifier @scope_qualifier end |
#timeout ⇒ Integer
Returns Timeout in milliseconds.
21 22 23 |
# File 'lib/couchbase/query_options.rb', line 21 def timeout @timeout end |
Instance Method Details
#consistent_with(mutation_state) ⇒ Object
overrides consistency level set by #scan_consistency=
Sets the mutation tokens this query should be consistent with
121 122 123 124 |
# File 'lib/couchbase/query_options.rb', line 121 def consistent_with(mutation_state) @scan_consistency = nil if @scan_consistency @mutation_state = mutation_state end |
#named_parameters(named) ⇒ Object
Sets named parameters for the query
143 144 145 146 |
# File 'lib/couchbase/query_options.rb', line 143 def named_parameters(named) @named_parameters = named @positional_parameters = nil end |
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query
129 130 131 132 |
# File 'lib/couchbase/query_options.rb', line 129 def positional_parameters(positional) @positional_parameters = positional @named_parameters = nil end |
#raw(key, value) ⇒ Object
Allows providing custom JSON key/value pairs for advanced usage
96 97 98 |
# File 'lib/couchbase/query_options.rb', line 96 def raw(key, value) @raw_parameters[key] = JSON.generate(value) end |