couchbase 3.4.1-arm64-darwin-20 → 3.4.3-arm64-darwin-20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +13 -13
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/json_transcoder.rb +12 -5
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
- data/lib/couchbase/management/query_index_manager.rb +70 -5
- data/lib/couchbase/options.rb +85 -2
- data/lib/couchbase/raw_binary_transcoder.rb +37 -0
- data/lib/couchbase/raw_json_transcoder.rb +38 -0
- data/lib/couchbase/raw_string_transcoder.rb +40 -0
- data/lib/couchbase/search_options.rb +163 -240
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/version.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7781858dae225372665d58fecb6eccadbd09828de8324398143a6233ac2b8a26
|
4
|
+
data.tar.gz: 5f9886de965d9fc967e7c241cff4cffd284002e491e8438b42a054dbcacf7571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da37e980f2852accdaa22c27e214b8a1e9cc6edb5fd690a9c57c5b8db3daddb180b40e34fb4acdd25df5b76292f6a5b3fb158edad4d6ce5f27ea2877c08e90fd
|
7
|
+
data.tar.gz: 4c2e1d4aa7ae3f60dacd18e2edcf299ceca355c6f4b2a84264bf928df09e418a0484868a93f7166c89ad53d0b048637ccde0e4e33d608351f69102c11198cb93
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ The library has been tested with MRI 3.0, 3.1 and 3.2. Supported platforms are L
|
|
23
23
|
Add this line to your application's Gemfile:
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
gem "couchbase", "3.4.
|
26
|
+
gem "couchbase", "3.4.3"
|
27
27
|
```
|
28
28
|
|
29
29
|
And then execute:
|
@@ -139,7 +139,7 @@ Now the API reference is accessible using a web browser (where `VERSION` is the
|
|
139
139
|
|
140
140
|
The gem is available as open source under the terms of the [Apache2 License](https://opensource.org/licenses/Apache-2.0).
|
141
141
|
|
142
|
-
Copyright 2011-
|
142
|
+
Copyright 2011-Present Couchbase, Inc.
|
143
143
|
|
144
144
|
Licensed under the Apache License, Version 2.0 (the "License");
|
145
145
|
you may not use this file except in compliance with the License.
|
data/lib/couchbase/cluster.rb
CHANGED
@@ -32,13 +32,13 @@ module Couchbase
|
|
32
32
|
|
33
33
|
# Connect to the Couchbase cluster
|
34
34
|
#
|
35
|
-
# @overload connect(
|
36
|
-
# @param [String]
|
35
|
+
# @overload connect(connection_string_or_config, options)
|
36
|
+
# @param [String, Configuration] connection_string_or_config connection string used to locate the Couchbase Cluster
|
37
37
|
# @param [Options::Cluster] options custom options when creating the cluster connection
|
38
38
|
#
|
39
|
-
# @overload connect(
|
39
|
+
# @overload connect(connection_string_or_config, username, password, options)
|
40
40
|
# Shortcut for {PasswordAuthenticator}
|
41
|
-
# @param [String]
|
41
|
+
# @param [String] connection_string_or_config connection string used to locate the Couchbase Cluster
|
42
42
|
# @param [String] username name of the user
|
43
43
|
# @param [String] password password of the user
|
44
44
|
# @param [Options::Cluster, nil] options custom options when creating the cluster connection
|
@@ -62,12 +62,16 @@ module Couchbase
|
|
62
62
|
# @see https://docs.couchbase.com/server/current/manage/manage-security/configure-client-certificates.html
|
63
63
|
#
|
64
64
|
# @return [Cluster]
|
65
|
-
def self.connect(
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
def self.connect(connection_string_or_config, *options)
|
66
|
+
connection_string = if connection_string_or_config.is_a?(Configuration)
|
67
|
+
connection_string_or_config.connection_string
|
68
|
+
else
|
69
|
+
connection_string_or_config
|
70
|
+
end
|
71
|
+
if connection_string =~ /\Acouchbases?:\/\/.*\z/i || !connection_string.include?("://")
|
72
|
+
Cluster.new(connection_string_or_config, *options)
|
69
73
|
else
|
70
|
-
ClusterRegistry.instance.connect(
|
74
|
+
ClusterRegistry.instance.connect(connection_string_or_config, *options)
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
@@ -382,8 +386,6 @@ module Couchbase
|
|
382
386
|
raise ArgumentError, "missing connection_string" unless connection_string
|
383
387
|
raise ArgumentError, "missing username" unless credentials[:username]
|
384
388
|
raise ArgumentError, "missing password" unless credentials[:password]
|
385
|
-
|
386
|
-
open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
|
387
389
|
else
|
388
390
|
options = args.shift
|
389
391
|
case options
|
@@ -392,8 +394,6 @@ module Couchbase
|
|
392
394
|
credentials[:password] = args.shift
|
393
395
|
raise ArgumentError, "missing username" unless credentials[:username]
|
394
396
|
raise ArgumentError, "missing password" unless credentials[:password]
|
395
|
-
|
396
|
-
open_options[:allowed_sasl_mechanisms] = PasswordAuthenticator::DEFAULT_SASL_MECHANISMS
|
397
397
|
when Options::Cluster
|
398
398
|
open_options = options&.to_backend || {}
|
399
399
|
authenticator = options&.authenticator
|
@@ -26,9 +26,14 @@ module Couchbase
|
|
26
26
|
@handlers = {}
|
27
27
|
end
|
28
28
|
|
29
|
-
def connect(
|
29
|
+
def connect(connection_string_or_config, *options)
|
30
|
+
connection_string = if connection_string_or_config.is_a?(Configuration)
|
31
|
+
connection_string_or_config.connection_string
|
32
|
+
else
|
33
|
+
connection_string_or_config
|
34
|
+
end
|
30
35
|
@handlers.each do |regexp, cluster_class|
|
31
|
-
return cluster_class.connect(
|
36
|
+
return cluster_class.connect(connection_string_or_config, *options) if regexp.match?(connection_string)
|
32
37
|
end
|
33
38
|
raise(Error::FeatureNotAvailable, "Connection string '#{connection_string}' not supported.")
|
34
39
|
end
|
@@ -33,10 +33,9 @@ module Couchbase
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def load_configuration(settings)
|
36
|
-
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@password = configuration[:password]
|
36
|
+
@connection_string = settings[:connection_string] || settings["connection_string"]
|
37
|
+
@username = settings[:username] || settings["username"]
|
38
|
+
@password = settings[:password] || settings["password"]
|
40
39
|
end
|
41
40
|
|
42
41
|
def load_yaml(path, environment)
|
@@ -14,18 +14,25 @@
|
|
14
14
|
|
15
15
|
require "json"
|
16
16
|
|
17
|
+
require "couchbase/transcoder_flags"
|
18
|
+
|
17
19
|
module Couchbase
|
18
20
|
class JsonTranscoder
|
19
21
|
# @param [Object] document
|
20
22
|
# @return [Array<String, Integer>] pair of encoded document and flags
|
21
23
|
def encode(document)
|
22
|
-
|
24
|
+
raise Error::EncodingFailure, "The JsonTranscoder does not support binary data" if document.is_a?(String) && !document.valid_encoding?
|
25
|
+
|
26
|
+
[JSON.generate(document), TranscoderFlags.new(format: :json, lower_bits: 6).encode]
|
23
27
|
end
|
24
28
|
|
25
|
-
# @param [String
|
26
|
-
# @param [Integer, :json]
|
27
|
-
# @return Object decoded document
|
28
|
-
def decode(blob,
|
29
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
30
|
+
# @param [Integer, :json] flags bit field, describing how the data encoded
|
31
|
+
# @return [Object] decoded document
|
32
|
+
def decode(blob, flags)
|
33
|
+
format = TranscoderFlags.decode(flags).format
|
34
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the JsonTranscoder" unless format == :json || format.nil?
|
35
|
+
|
29
36
|
JSON.parse(blob) unless blob&.empty?
|
30
37
|
end
|
31
38
|
end
|
Binary file
|
@@ -14,6 +14,7 @@
|
|
14
14
|
|
15
15
|
require "couchbase/management/query_index_manager"
|
16
16
|
require "couchbase/utils/time"
|
17
|
+
require "couchbase/errors"
|
17
18
|
|
18
19
|
module Couchbase
|
19
20
|
module Management
|
@@ -37,8 +38,18 @@ module Couchbase
|
|
37
38
|
#
|
38
39
|
# @return [Array<QueryIndex>]
|
39
40
|
#
|
40
|
-
# @raise [
|
41
|
+
# @raise [Error::InvalidArgument]
|
41
42
|
def get_all_indexes(options = Options::Query::GetAllIndexes.new)
|
43
|
+
unless options.scope_name.nil?
|
44
|
+
raise Error::InvalidArgument,
|
45
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
46
|
+
end
|
47
|
+
|
48
|
+
unless options.collection_name.nil?
|
49
|
+
raise Error::InvalidArgument,
|
50
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
51
|
+
end
|
52
|
+
|
42
53
|
res = @backend.collection_query_index_get_all(@bucket_name, @scope_name, @collection_name, options.to_backend)
|
43
54
|
res[:indexes].map do |idx|
|
44
55
|
QueryIndex.new do |index|
|
@@ -64,15 +75,17 @@ module Couchbase
|
|
64
75
|
#
|
65
76
|
# @return void
|
66
77
|
#
|
67
|
-
# @raise [
|
78
|
+
# @raise [Error::InvalidArgument]
|
68
79
|
# @raise [Error::IndexExists]
|
69
80
|
def create_index(index_name, fields, options = Options::Query::CreateIndex.new)
|
70
81
|
unless options.scope_name.nil?
|
71
|
-
raise
|
82
|
+
raise Error::InvalidArgument,
|
83
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
72
84
|
end
|
73
85
|
|
74
86
|
unless options.collection_name.nil?
|
75
|
-
raise
|
87
|
+
raise Error::InvalidArgument,
|
88
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
76
89
|
end
|
77
90
|
|
78
91
|
@backend.collection_query_index_create(@bucket_name, @scope_name, @collection_name, index_name, fields, options.to_backend)
|
@@ -84,15 +97,17 @@ module Couchbase
|
|
84
97
|
#
|
85
98
|
# @return void
|
86
99
|
#
|
87
|
-
# @raise [
|
100
|
+
# @raise [Error::InvalidArgument]
|
88
101
|
# @raise [Error::IndexExists]
|
89
102
|
def create_primary_index(options = Options::Query::CreatePrimaryIndex.new)
|
90
103
|
unless options.scope_name.nil?
|
91
|
-
raise
|
104
|
+
raise Error::InvalidArgument,
|
105
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
92
106
|
end
|
93
107
|
|
94
108
|
unless options.collection_name.nil?
|
95
|
-
raise
|
109
|
+
raise Error::InvalidArgument,
|
110
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
96
111
|
end
|
97
112
|
|
98
113
|
@backend.collection_query_index_create_primary(@bucket_name, @scope_name, @collection_name, options.to_backend)
|
@@ -105,15 +120,17 @@ module Couchbase
|
|
105
120
|
#
|
106
121
|
# @return void
|
107
122
|
#
|
108
|
-
# @raise [
|
123
|
+
# @raise [Error::InvalidArgument]
|
109
124
|
# @raise [Error::IndexNotFound]
|
110
125
|
def drop_index(index_name, options = Options::Query::DropIndex.new)
|
111
126
|
unless options.scope_name.nil?
|
112
|
-
raise
|
127
|
+
raise Error::InvalidArgument,
|
128
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
113
129
|
end
|
114
130
|
|
115
131
|
unless options.collection_name.nil?
|
116
|
-
raise
|
132
|
+
raise Error::InvalidArgument,
|
133
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
117
134
|
end
|
118
135
|
|
119
136
|
@backend.collection_query_index_drop(@bucket_name, @scope_name, @collection_name, index_name, options.to_backend)
|
@@ -125,15 +142,17 @@ module Couchbase
|
|
125
142
|
#
|
126
143
|
# @return void
|
127
144
|
#
|
128
|
-
# @raise [
|
145
|
+
# @raise [Error::InvalidArgument]
|
129
146
|
# @raise [Error::IndexNotFound]
|
130
147
|
def drop_primary_index(options = Options::Query::DropPrimaryIndex.new)
|
131
148
|
unless options.scope_name.nil?
|
132
|
-
raise
|
149
|
+
raise Error::InvalidArgument,
|
150
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
133
151
|
end
|
134
152
|
|
135
153
|
unless options.collection_name.nil?
|
136
|
-
raise
|
154
|
+
raise Error::InvalidArgument,
|
155
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
137
156
|
end
|
138
157
|
|
139
158
|
@backend.collection_query_index_drop_primary(@bucket_name, @scope_name, @collection_name, options.to_backend)
|
@@ -145,8 +164,18 @@ module Couchbase
|
|
145
164
|
#
|
146
165
|
# @return void
|
147
166
|
#
|
148
|
-
# @raise [
|
167
|
+
# @raise [Error::InvalidArgument]
|
149
168
|
def build_deferred_indexes(options = Options::Query::BuildDeferredIndexes.new)
|
169
|
+
unless options.scope_name.nil?
|
170
|
+
raise Error::InvalidArgument,
|
171
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
172
|
+
end
|
173
|
+
|
174
|
+
unless options.collection_name.nil?
|
175
|
+
raise Error::InvalidArgument,
|
176
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
177
|
+
end
|
178
|
+
|
150
179
|
@backend.collection_query_index_build_deferred(@bucket_name, @scope_name, @collection_name, options.to_backend)
|
151
180
|
end
|
152
181
|
|
@@ -156,9 +185,19 @@ module Couchbase
|
|
156
185
|
# @param [Integer, #in_milliseconds] timeout the time in milliseconds allowed for the operation to complete
|
157
186
|
# @param [Options::Query::WatchIndexes] options
|
158
187
|
#
|
159
|
-
# @raise [
|
188
|
+
# @raise [Error::InvalidArgument]
|
160
189
|
# @raise [Error::IndexNotFound]
|
161
190
|
def watch_indexes(index_names, timeout, options = Options::Query::WatchIndexes.new)
|
191
|
+
unless options.scope_name.nil?
|
192
|
+
raise Error::InvalidArgument,
|
193
|
+
"Scope name cannot be set in the options when using the Query Index manager at the collection level"
|
194
|
+
end
|
195
|
+
|
196
|
+
unless options.collection_name.nil?
|
197
|
+
raise Error::InvalidArgument,
|
198
|
+
"Collection name cannot be set in the options when using the Query Index manager at the collection level"
|
199
|
+
end
|
200
|
+
|
162
201
|
index_names.append("#primary") if options.watch_primary
|
163
202
|
|
164
203
|
interval_millis = 50
|
@@ -22,21 +22,40 @@ module Couchbase
|
|
22
22
|
module Query
|
23
23
|
# Options for {QueryIndexManager#get_all_indexes}
|
24
24
|
class GetAllIndexes < ::Couchbase::Options::Base
|
25
|
+
attr_accessor :scope_name # @return [String, nil]
|
26
|
+
attr_accessor :collection_name # @return [String, nil]
|
27
|
+
|
25
28
|
# Creates an instance of options for {QueryIndexManager#get_all_indexes}
|
26
29
|
#
|
30
|
+
# @param [String, nil] scope_name the name of the scope
|
31
|
+
# @param [String, nil] collection_name the name of the collection
|
32
|
+
#
|
27
33
|
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
28
34
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
29
35
|
# @param [Hash, nil] client_context the client context data, if set
|
30
36
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
31
37
|
#
|
32
38
|
# @yieldparam [GetAllScopes] self
|
33
|
-
def initialize(
|
39
|
+
def initialize(scope_name: nil,
|
40
|
+
collection_name: nil,
|
41
|
+
timeout: nil,
|
34
42
|
retry_strategy: nil,
|
35
43
|
client_context: nil,
|
36
44
|
parent_span: nil)
|
37
|
-
super
|
45
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
46
|
+
@scope_name = scope_name
|
47
|
+
@collection_name = collection_name
|
38
48
|
yield self if block_given?
|
39
49
|
end
|
50
|
+
|
51
|
+
# @api private
|
52
|
+
def to_backend
|
53
|
+
{
|
54
|
+
timeout: Utils::Time.extract_duration(@timeout),
|
55
|
+
scope_name: @scope_name,
|
56
|
+
collection_name: @collection_name,
|
57
|
+
}
|
58
|
+
end
|
40
59
|
end
|
41
60
|
|
42
61
|
# Options for {QueryIndexManager#create_index}
|
@@ -102,6 +121,7 @@ module Couchbase
|
|
102
121
|
attr_accessor :ignore_if_exists # @return [Boolean]
|
103
122
|
attr_accessor :num_replicas # @return [Integer, nil]
|
104
123
|
attr_accessor :deferred # @return [Boolean]
|
124
|
+
attr_accessor :index_name # @return [String. nil]
|
105
125
|
attr_accessor :scope_name # @return [String, nil]
|
106
126
|
attr_accessor :collection_name # @return [String, nil]
|
107
127
|
|
@@ -110,6 +130,7 @@ module Couchbase
|
|
110
130
|
# @param [Boolean] ignore_if_exists do not raise error if the index already exist
|
111
131
|
# @param [Integer] num_replicas the number of replicas that this index should have
|
112
132
|
# @param [Boolean] deferred whether the index should be created as a deferred index.
|
133
|
+
# @param [String, nil] index_name the custom name of the primary index.
|
113
134
|
# @param [String, nil] scope_name the name of the scope
|
114
135
|
# @param [String, nil] collection_name the name of the collection
|
115
136
|
#
|
@@ -122,6 +143,7 @@ module Couchbase
|
|
122
143
|
def initialize(ignore_if_exists: false,
|
123
144
|
num_replicas: nil,
|
124
145
|
deferred: false,
|
146
|
+
index_name: nil,
|
125
147
|
scope_name: nil,
|
126
148
|
collection_name: nil,
|
127
149
|
timeout: nil,
|
@@ -132,6 +154,7 @@ module Couchbase
|
|
132
154
|
@ignore_if_exists = ignore_if_exists
|
133
155
|
@num_replicas = num_replicas
|
134
156
|
@deferred = deferred
|
157
|
+
@index_name = index_name
|
135
158
|
@scope_name = scope_name
|
136
159
|
@collection_name = collection_name
|
137
160
|
yield self if block_given?
|
@@ -144,6 +167,7 @@ module Couchbase
|
|
144
167
|
ignore_if_exists: @ignore_if_exists,
|
145
168
|
deferred: @deferred,
|
146
169
|
num_replicas: @num_replicas,
|
170
|
+
index_name: @index_name,
|
147
171
|
scope_name: @scope_name,
|
148
172
|
collection_name: @collection_name,
|
149
173
|
}
|
@@ -238,7 +262,12 @@ module Couchbase
|
|
238
262
|
|
239
263
|
# Options for {QueryIndexManager#build_deferred_indexes}
|
240
264
|
class BuildDeferredIndexes < ::Couchbase::Options::Base
|
265
|
+
attr_accessor :scope_name # @return [String, nil]
|
266
|
+
attr_accessor :collection_name # @return [String, nil]
|
267
|
+
|
241
268
|
# Creates an instance of options for {QueryIndexManager#build_deferred_indexes}
|
269
|
+
# @param [String, nil] scope_name the name of the scope
|
270
|
+
# @param [String, nil] collection_name the name of the collection
|
242
271
|
#
|
243
272
|
# @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
|
244
273
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -246,33 +275,55 @@ module Couchbase
|
|
246
275
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
247
276
|
#
|
248
277
|
# @yieldparam [GetAllScopes] self
|
249
|
-
def initialize(
|
278
|
+
def initialize(scope_name: nil,
|
279
|
+
collection_name: nil,
|
280
|
+
timeout: nil,
|
250
281
|
retry_strategy: nil,
|
251
282
|
client_context: nil,
|
252
283
|
parent_span: nil)
|
253
|
-
super
|
284
|
+
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
285
|
+
@scope_name = scope_name
|
286
|
+
@collection_name = collection_name
|
254
287
|
yield self if block_given?
|
255
288
|
end
|
289
|
+
|
290
|
+
# @api private
|
291
|
+
def to_backend
|
292
|
+
{
|
293
|
+
timeout: Utils::Time.extract_duration(@timeout),
|
294
|
+
scope_name: @scope_name,
|
295
|
+
collection_name: @collection_name,
|
296
|
+
}
|
297
|
+
end
|
256
298
|
end
|
257
299
|
|
258
300
|
# Options for {QueryIndexManager#watch_indexes}
|
259
301
|
class WatchIndexes < ::Couchbase::Options::Base
|
260
302
|
attr_accessor :watch_primary # @return [Boolean]
|
303
|
+
attr_accessor :scope_name # @return [String, nil]
|
304
|
+
attr_accessor :collection_name # @return [String, nil]
|
261
305
|
|
262
306
|
# Creates an instance of options for {QueryIndexManager#watch_indexes}
|
263
307
|
#
|
264
308
|
# @param [Boolean] watch_primary whether or not to watch the primary index
|
309
|
+
# @param [String, nil] scope_name the name of the scope
|
310
|
+
# @param [String, nil] collection_name the name of the collection
|
311
|
+
#
|
265
312
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
266
313
|
# @param [Hash, nil] client_context the client context data, if set
|
267
314
|
# @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
|
268
315
|
#
|
269
316
|
# @yieldparam [GetAllScopes] self
|
270
317
|
def initialize(watch_primary: false,
|
318
|
+
scope_name: nil,
|
319
|
+
collection_name: nil,
|
271
320
|
retry_strategy: nil,
|
272
321
|
client_context: nil,
|
273
322
|
parent_span: nil)
|
274
323
|
super(timeout: nil, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
275
324
|
@watch_primary = watch_primary
|
325
|
+
@scope_name = scope_name
|
326
|
+
@collection_name = collection_name
|
276
327
|
yield self if block_given?
|
277
328
|
end
|
278
329
|
|
@@ -280,6 +331,8 @@ module Couchbase
|
|
280
331
|
def to_backend
|
281
332
|
{
|
282
333
|
watch_primary: @watch_primary,
|
334
|
+
scope_name: @scope_name,
|
335
|
+
collection_name: @collection_name,
|
283
336
|
}
|
284
337
|
end
|
285
338
|
end
|
@@ -343,6 +396,10 @@ module Couchbase
|
|
343
396
|
#
|
344
397
|
# @raise [ArgumentError]
|
345
398
|
def get_all_indexes(bucket_name, options = GetAllIndexOptions.new)
|
399
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
400
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
401
|
+
end
|
402
|
+
|
346
403
|
res = @backend.query_index_get_all(bucket_name, options.to_backend)
|
347
404
|
res[:indexes].map do |idx|
|
348
405
|
QueryIndex.new do |index|
|
@@ -436,10 +493,14 @@ module Couchbase
|
|
436
493
|
# @param [String] bucket_name name of the bucket
|
437
494
|
# @param [Options::Query::BuildDeferredIndexes] options
|
438
495
|
#
|
439
|
-
# @return
|
496
|
+
# @return
|
440
497
|
#
|
441
498
|
# @raise [ArgumentError]
|
442
499
|
def build_deferred_indexes(bucket_name, options = Options::Query::BuildDeferredIndexes.new)
|
500
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
501
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
502
|
+
end
|
503
|
+
|
443
504
|
@backend.query_index_build_deferred(bucket_name, options.to_backend)
|
444
505
|
end
|
445
506
|
|
@@ -453,6 +514,10 @@ module Couchbase
|
|
453
514
|
# @raise [ArgumentError]
|
454
515
|
# @raise [Error::IndexNotFound]
|
455
516
|
def watch_indexes(bucket_name, index_names, timeout, options = Options::Query::WatchIndexes.new)
|
517
|
+
unless options.scope_name.nil? && options.collection_name.nil?
|
518
|
+
warn "The attributes 'scope_name' and 'collection_name' have been deprecated. Use 'collection.query_indexes' instead"
|
519
|
+
end
|
520
|
+
|
456
521
|
index_names.append("#primary") if options.watch_primary
|
457
522
|
|
458
523
|
interval_millis = 50
|