Class: Couchbase::Cluster::QueryOptions
- Inherits:
-
Object
- Object
- Couchbase::Cluster::QueryOptions
- Defined in:
- lib/couchbase/query_options.rb
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.
-
#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.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/couchbase/query_options.rb', line 71 def initialize @timeout = 75_000 # ms @adhoc = true @raw_parameters = {} @positional_parameters = nil @named_parameters = nil @scan_consistency = nil @mutation_state = nil yield self if block_given? end |
Instance Attribute Details
#adhoc ⇒ Boolean
Returns Allows turning this request into a prepared statement query.
25 26 27 |
# File 'lib/couchbase/query_options.rb', line 25 def adhoc @adhoc end |
#client_context_id ⇒ String
Returns Provides a custom client context ID for this query.
28 29 30 |
# File 'lib/couchbase/query_options.rb', line 28 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.
31 32 33 |
# File 'lib/couchbase/query_options.rb', line 31 def max_parallelism @max_parallelism end |
#metrics ⇒ Boolean
Returns Enables per-request metrics in the trailing section of the query.
54 55 56 |
# File 'lib/couchbase/query_options.rb', line 54 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.
51 52 53 |
# File 'lib/couchbase/query_options.rb', line 51 def pipeline_cap @pipeline_cap end |
#profile ⇒ :off, ...
Returns Customize server profile level for this query.
57 58 59 |
# File 'lib/couchbase/query_options.rb', line 57 def profile @profile end |
#readonly ⇒ Boolean
Returns Allows explicitly marking a query as being readonly and not mutating any documents on the server side.
34 35 36 |
# File 'lib/couchbase/query_options.rb', line 34 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
60 61 62 |
# File 'lib/couchbase/query_options.rb', line 60 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 |
#timeout ⇒ Integer
Returns Timeout in milliseconds.
22 23 24 |
# File 'lib/couchbase/query_options.rb', line 22 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
109 110 111 112 |
# File 'lib/couchbase/query_options.rb', line 109 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
131 132 133 134 |
# File 'lib/couchbase/query_options.rb', line 131 def named_parameters(named) @named_parameters = named @positional_parameters = nil end |
#positional_parameters(positional) ⇒ Object
Sets positional parameters for the query
117 118 119 120 |
# File 'lib/couchbase/query_options.rb', line 117 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
86 87 88 |
# File 'lib/couchbase/query_options.rb', line 86 def raw(key, value) @raw_parameters[key] = JSON.generate(value) end |