couchbase 3.0.0.beta.1-universal-darwin-19 → 3.0.0-universal-darwin-19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +227 -0
  3. data/.rubocop_todo.yml +47 -0
  4. data/CONTRIBUTING.md +110 -0
  5. data/Gemfile +4 -0
  6. data/README.md +3 -3
  7. data/Rakefile +1 -1
  8. data/couchbase.gemspec +40 -39
  9. data/examples/analytics.rb +123 -108
  10. data/examples/auth.rb +33 -0
  11. data/examples/crud.rb +16 -2
  12. data/examples/managing_analytics_indexes.rb +18 -4
  13. data/examples/managing_buckets.rb +17 -3
  14. data/examples/managing_collections.rb +22 -9
  15. data/examples/managing_query_indexes.rb +38 -18
  16. data/examples/managing_search_indexes.rb +21 -6
  17. data/examples/managing_view_indexes.rb +18 -4
  18. data/examples/query.rb +17 -3
  19. data/examples/query_with_consistency.rb +30 -20
  20. data/examples/search.rb +116 -101
  21. data/examples/search_with_consistency.rb +43 -30
  22. data/examples/subdocument.rb +42 -30
  23. data/examples/view.rb +19 -10
  24. data/ext/CMakeLists.txt +40 -2
  25. data/ext/build_version.hxx.in +1 -1
  26. data/ext/couchbase/bucket.hxx +190 -38
  27. data/ext/couchbase/cluster.hxx +22 -4
  28. data/ext/couchbase/configuration.hxx +14 -14
  29. data/ext/couchbase/couchbase.cxx +108 -12
  30. data/ext/couchbase/error_map.hxx +202 -2
  31. data/ext/couchbase/errors.hxx +8 -2
  32. data/ext/couchbase/io/dns_client.hxx +6 -6
  33. data/ext/couchbase/io/http_command.hxx +2 -2
  34. data/ext/couchbase/io/http_session.hxx +7 -11
  35. data/ext/couchbase/io/http_session_manager.hxx +3 -3
  36. data/ext/couchbase/io/mcbp_command.hxx +101 -44
  37. data/ext/couchbase/io/mcbp_session.hxx +144 -49
  38. data/ext/couchbase/io/retry_action.hxx +30 -0
  39. data/ext/couchbase/io/retry_context.hxx +39 -0
  40. data/ext/couchbase/io/retry_orchestrator.hxx +96 -0
  41. data/ext/couchbase/io/retry_reason.hxx +235 -0
  42. data/ext/couchbase/io/retry_strategy.hxx +156 -0
  43. data/ext/couchbase/operations/document_decrement.hxx +2 -0
  44. data/ext/couchbase/operations/document_exists.hxx +2 -0
  45. data/ext/couchbase/operations/document_get.hxx +2 -0
  46. data/ext/couchbase/operations/document_get_and_lock.hxx +2 -0
  47. data/ext/couchbase/operations/document_get_and_touch.hxx +2 -0
  48. data/ext/couchbase/operations/document_get_projected.hxx +2 -0
  49. data/ext/couchbase/operations/document_increment.hxx +2 -0
  50. data/ext/couchbase/operations/document_insert.hxx +2 -0
  51. data/ext/couchbase/operations/document_lookup_in.hxx +2 -0
  52. data/ext/couchbase/operations/document_mutate_in.hxx +3 -0
  53. data/ext/couchbase/operations/document_query.hxx +10 -0
  54. data/ext/couchbase/operations/document_remove.hxx +2 -0
  55. data/ext/couchbase/operations/document_replace.hxx +2 -0
  56. data/ext/couchbase/operations/document_search.hxx +8 -3
  57. data/ext/couchbase/operations/document_touch.hxx +2 -0
  58. data/ext/couchbase/operations/document_unlock.hxx +2 -0
  59. data/ext/couchbase/operations/document_upsert.hxx +2 -0
  60. data/ext/couchbase/operations/query_index_create.hxx +14 -4
  61. data/ext/couchbase/operations/query_index_drop.hxx +12 -2
  62. data/ext/couchbase/operations/query_index_get_all.hxx +11 -2
  63. data/ext/couchbase/origin.hxx +47 -17
  64. data/ext/couchbase/platform/backtrace.c +189 -0
  65. data/ext/couchbase/platform/backtrace.h +54 -0
  66. data/ext/couchbase/platform/terminate_handler.cc +122 -0
  67. data/ext/couchbase/platform/terminate_handler.h +36 -0
  68. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +6 -1
  69. data/ext/couchbase/protocol/status.hxx +14 -4
  70. data/ext/couchbase/version.hxx +2 -2
  71. data/ext/extconf.rb +39 -36
  72. data/ext/test/main.cxx +64 -16
  73. data/lib/couchbase.rb +0 -1
  74. data/lib/couchbase/analytics_options.rb +2 -4
  75. data/lib/couchbase/authenticator.rb +14 -0
  76. data/lib/couchbase/binary_collection.rb +9 -9
  77. data/lib/couchbase/binary_collection_options.rb +8 -6
  78. data/lib/couchbase/bucket.rb +18 -18
  79. data/lib/couchbase/cluster.rb +121 -90
  80. data/lib/couchbase/collection.rb +36 -38
  81. data/lib/couchbase/collection_options.rb +31 -17
  82. data/lib/couchbase/common_options.rb +1 -1
  83. data/lib/couchbase/datastructures/couchbase_list.rb +16 -16
  84. data/lib/couchbase/datastructures/couchbase_map.rb +18 -18
  85. data/lib/couchbase/datastructures/couchbase_queue.rb +13 -13
  86. data/lib/couchbase/datastructures/couchbase_set.rb +8 -7
  87. data/lib/couchbase/errors.rb +10 -3
  88. data/lib/couchbase/json_transcoder.rb +2 -2
  89. data/lib/couchbase/libcouchbase.bundle +0 -0
  90. data/lib/couchbase/management/analytics_index_manager.rb +37 -37
  91. data/lib/couchbase/management/bucket_manager.rb +25 -25
  92. data/lib/couchbase/management/collection_manager.rb +3 -3
  93. data/lib/couchbase/management/query_index_manager.rb +59 -14
  94. data/lib/couchbase/management/search_index_manager.rb +15 -12
  95. data/lib/couchbase/management/user_manager.rb +1 -1
  96. data/lib/couchbase/management/view_index_manager.rb +11 -5
  97. data/lib/couchbase/mutation_state.rb +12 -0
  98. data/lib/couchbase/query_options.rb +23 -9
  99. data/lib/couchbase/scope.rb +61 -1
  100. data/lib/couchbase/search_options.rb +40 -27
  101. data/lib/couchbase/subdoc.rb +31 -28
  102. data/lib/couchbase/version.rb +2 -2
  103. data/lib/couchbase/view_options.rb +0 -1
  104. metadata +20 -7
@@ -63,14 +63,14 @@ module Couchbase
63
63
  # @return [Integer] returns the number of elements in the queue.
64
64
  def length
65
65
  result = @collection.lookup_in(@id, [
66
- LookupInSpec.count("")
67
- ], @options.lookup_in_options)
66
+ LookupInSpec.count(""),
67
+ ], @options.lookup_in_options)
68
68
  result.content(0)
69
69
  rescue Error::DocumentNotFound
70
70
  0
71
71
  end
72
72
 
73
- alias_method :size, :length
73
+ alias size length
74
74
 
75
75
  # @return [Boolean] returns true if queue is empty
76
76
  def empty?
@@ -92,30 +92,30 @@ module Couchbase
92
92
  def push(obj)
93
93
  begin
94
94
  @collection.mutate_in(@id, [
95
- MutateInSpec.array_prepend("", [obj])
96
- ], @options.mutate_in_options)
95
+ MutateInSpec.array_prepend("", [obj]),
96
+ ], @options.mutate_in_options)
97
97
  rescue Error::PathExists
98
98
  # ignore
99
99
  end
100
100
  self
101
101
  end
102
102
 
103
- alias_method :enq, :push
104
- alias_method :<<, :push
103
+ alias enq push
104
+ alias << push
105
105
 
106
106
  # Retrieves object from the queue
107
107
  #
108
108
  # @return [Object, nil] queue entry or nil
109
109
  def pop
110
110
  result = @collection.lookup_in(@id, [
111
- LookupInSpec.get("[-1]")
112
- ], @options.lookup_in_options)
111
+ LookupInSpec.get("[-1]"),
112
+ ], @options.lookup_in_options)
113
113
  obj = result.exists?(0) ? result.content(0) : nil
114
114
  options = Collection::MutateInOptions.new
115
115
  options.cas = result.cas
116
116
  @collection.mutate_in(@id, [
117
- MutateInSpec.remove("[-1]")
118
- ], options)
117
+ MutateInSpec.remove("[-1]"),
118
+ ], options)
119
119
  obj
120
120
  rescue Error::CasMismatch
121
121
  retry
@@ -123,8 +123,8 @@ module Couchbase
123
123
  nil
124
124
  end
125
125
 
126
- alias_method :deq, :pop
127
- alias_method :shift, :pop
126
+ alias deq pop
127
+ alias shift pop
128
128
  end
129
129
 
130
130
  class CouchbaseQueueOptions
@@ -63,14 +63,14 @@ module Couchbase
63
63
  # @return [Integer] returns the number of elements in the set.
64
64
  def length
65
65
  result = @collection.lookup_in(@id, [
66
- LookupInSpec.count("")
67
- ], @options.lookup_in_options)
66
+ LookupInSpec.count(""),
67
+ ], @options.lookup_in_options)
68
68
  result.content(0)
69
69
  rescue Error::DocumentNotFound
70
70
  0
71
71
  end
72
72
 
73
- alias_method :size, :length
73
+ alias size length
74
74
 
75
75
  # @return [Boolean] returns true if set is empty
76
76
  def empty?
@@ -84,8 +84,8 @@ module Couchbase
84
84
  def add(obj)
85
85
  begin
86
86
  @collection.mutate_in(@id, [
87
- MutateInSpec.array_add_unique("", obj)
88
- ], @options.mutate_in_options)
87
+ MutateInSpec.array_add_unique("", obj),
88
+ ], @options.mutate_in_options)
89
89
  rescue Error::PathExists
90
90
  # ignore
91
91
  end
@@ -107,11 +107,12 @@ module Couchbase
107
107
  result = @collection.get(@id)
108
108
  idx = result.content.index(obj)
109
109
  return false unless idx
110
+
110
111
  options = Collection::MutateInOptions.new
111
112
  options.cas = result.cas
112
113
  @collection.mutate_in(@id, [
113
- MutateInSpec.remove("[#{idx}]")
114
- ], options)
114
+ MutateInSpec.remove("[#{idx}]"),
115
+ ], options)
115
116
  true
116
117
  rescue Error::CasMismatch
117
118
  retry
@@ -67,10 +67,13 @@ module Couchbase
67
67
  class UnsupportedOperation < CouchbaseError
68
68
  end
69
69
 
70
- class AmbiguousTimeout < CouchbaseError
70
+ class Timeout < CouchbaseError
71
71
  end
72
72
 
73
- class UnambiguousTimeout < CouchbaseError
73
+ class AmbiguousTimeout < Timeout
74
+ end
75
+
76
+ class UnambiguousTimeout < Timeout
74
77
  end
75
78
 
76
79
  class FeatureNotAvailable < CouchbaseError
@@ -164,7 +167,6 @@ module Couchbase
164
167
  class PreparedStatementFailure < CouchbaseError
165
168
  end
166
169
 
167
-
168
170
  # Analytics exceptions
169
171
 
170
172
  class CompilationFailure < CouchbaseError
@@ -188,6 +190,11 @@ module Couchbase
188
190
  class LinkNotFound < CouchbaseError
189
191
  end
190
192
 
193
+ # Search exceptions
194
+
195
+ class IndexNotReady < CouchbaseError
196
+ end
197
+
191
198
  # View exceptions
192
199
 
193
200
  class DesignDocumentNotFound < CouchbaseError
@@ -23,9 +23,9 @@ module Couchbase
23
23
  end
24
24
 
25
25
  # @param [String, nil] blob string of bytes, containing encoded representation of the document
26
- # @param [Integer, :json] flags bit field, describing how the data encoded
26
+ # @param [Integer, :json] _flags bit field, describing how the data encoded
27
27
  # @return Object decoded document
28
- def decode(blob, flags)
28
+ def decode(blob, _flags)
29
29
  JSON.parse(blob) unless blob.nil?
30
30
  end
31
31
  end
@@ -17,7 +17,7 @@ require "couchbase/errors"
17
17
  module Couchbase
18
18
  module Management
19
19
  class AnalyticsIndexManager
20
- alias_method :inspect, :to_s
20
+ alias inspect to_s
21
21
 
22
22
  # @param [Couchbase::Backend] backend
23
23
  def initialize(backend)
@@ -35,9 +35,9 @@ module Couchbase
35
35
  # @raise [Error::DataverseExists]
36
36
  def create_dataverse(dataverse_name, options = CreateDataverseOptions.new)
37
37
  @backend.analytics_dataverse_create(
38
- dataverse_name,
39
- options.ignore_if_exists,
40
- options.timeout
38
+ dataverse_name,
39
+ options.ignore_if_exists,
40
+ options.timeout
41
41
  )
42
42
  end
43
43
 
@@ -52,9 +52,9 @@ module Couchbase
52
52
  # @raise [Error::DataverseNotFound]
53
53
  def drop_dataverse(dataverse_name, options = DropDataverseOptions.new)
54
54
  @backend.analytics_dataverse_drop(
55
- dataverse_name,
56
- options.ignore_if_does_not_exist,
57
- options.timeout
55
+ dataverse_name,
56
+ options.ignore_if_does_not_exist,
57
+ options.timeout
58
58
  )
59
59
  end
60
60
 
@@ -71,12 +71,12 @@ module Couchbase
71
71
  # @raise [Error::LinkNotFound]
72
72
  def create_dataset(dataset_name, bucket_name, options = CreateDatasetOptions.new)
73
73
  @backend.analytics_dataset_create(
74
- dataset_name,
75
- bucket_name,
76
- options.condition,
77
- options.dataverse_name,
78
- options.ignore_if_exists,
79
- options.timeout
74
+ dataset_name,
75
+ bucket_name,
76
+ options.condition,
77
+ options.dataverse_name,
78
+ options.ignore_if_exists,
79
+ options.timeout
80
80
  )
81
81
  end
82
82
 
@@ -91,10 +91,10 @@ module Couchbase
91
91
  # @raise [Error::DatasetNotFound]
92
92
  def drop_dataset(dataset_name, options = DropDatasetOptions.new)
93
93
  @backend.analytics_dataset_drop(
94
- dataset_name,
95
- options.dataverse_name,
96
- options.ignore_if_does_not_exist,
97
- options.timeout
94
+ dataset_name,
95
+ options.dataverse_name,
96
+ options.ignore_if_does_not_exist,
97
+ options.timeout
98
98
  )
99
99
  end
100
100
 
@@ -128,12 +128,12 @@ module Couchbase
128
128
  # @raise [Error::IndexExists]
129
129
  def create_index(index_name, dataset_name, fields, options = CreateIndexOptions.new)
130
130
  @backend.analytics_index_create(
131
- index_name,
132
- dataset_name,
133
- fields.entries,
134
- options.dataverse_name,
135
- options.ignore_if_exists,
136
- options.timeout
131
+ index_name,
132
+ dataset_name,
133
+ fields.entries,
134
+ options.dataverse_name,
135
+ options.ignore_if_exists,
136
+ options.timeout
137
137
  )
138
138
  end
139
139
 
@@ -149,11 +149,11 @@ module Couchbase
149
149
  # @raise [Error::IndexNotFound]
150
150
  def drop_index(index_name, dataset_name, options = DropIndexOptions.new)
151
151
  @backend.analytics_index_drop(
152
- index_name,
153
- dataset_name,
154
- options.dataverse_name,
155
- options.ignore_if_does_not_exist,
156
- options.timeout
152
+ index_name,
153
+ dataset_name,
154
+ options.dataverse_name,
155
+ options.ignore_if_does_not_exist,
156
+ options.timeout
157
157
  )
158
158
  end
159
159
 
@@ -184,10 +184,10 @@ module Couchbase
184
184
  # @raise [Error::LinkNotFound]
185
185
  def connect_link(options = ConnectLinkOptions.new)
186
186
  @backend.analytics_link_connect(
187
- options.link_name,
188
- options.force,
189
- options.dataverse_name,
190
- options.timeout
187
+ options.link_name,
188
+ options.force,
189
+ options.dataverse_name,
190
+ options.timeout
191
191
  )
192
192
  end
193
193
 
@@ -201,9 +201,9 @@ module Couchbase
201
201
  # @raise [Error::LinkNotFound]
202
202
  def disconnect_link(options = DisconnectLinkOptions.new)
203
203
  @backend.analytics_link_disconnect(
204
- options.link_name,
205
- options.dataverse_name,
206
- options.timeout
204
+ options.link_name,
205
+ options.dataverse_name,
206
+ options.timeout
207
207
  )
208
208
  end
209
209
 
@@ -218,7 +218,7 @@ module Couchbase
218
218
  # and values are number of mutations for given dataset.
219
219
  def get_pending_mutations(options = GetPendingMutationsOptions.new)
220
220
  @backend.analytics_get_pending_mutations(
221
- options.timeout
221
+ options.timeout
222
222
  )
223
223
  end
224
224
 
@@ -422,7 +422,7 @@ module Couchbase
422
422
 
423
423
  # @return [Boolean]
424
424
  attr_accessor :is_primary
425
- alias_method :primary?, :is_primary
425
+ alias primary? is_primary
426
426
 
427
427
  # @yieldparam [AnalyticsIndex]
428
428
  def initialize
@@ -17,7 +17,7 @@ require "couchbase/errors"
17
17
  module Couchbase
18
18
  module Management
19
19
  class BucketManager
20
- alias_method :inspect, :to_s
20
+ alias inspect to_s
21
21
 
22
22
  # @param [Couchbase::Backend] backend
23
23
  def initialize(backend)
@@ -35,19 +35,19 @@ module Couchbase
35
35
  # @raise [Error::BucketExists]
36
36
  def create_bucket(settings, options = CreateBucketOptions.new)
37
37
  @backend.bucket_create(
38
- {
39
-
40
- name: settings.name,
41
- flush_enabled: settings.flush_enabled,
42
- ram_quota_mb: settings.ram_quota_mb,
43
- num_replicas: settings.num_replicas,
44
- replica_indexes: settings.replica_indexes,
45
- bucket_type: settings.bucket_type,
46
- ejection_policy: settings.ejection_policy,
47
- max_expiry: settings.max_expiry,
48
- compression_mode: settings.compression_mode,
49
- conflict_resolution_type: settings.conflict_resolution_type,
50
- }, options.timeout
38
+ {
39
+
40
+ name: settings.name,
41
+ flush_enabled: settings.flush_enabled,
42
+ ram_quota_mb: settings.ram_quota_mb,
43
+ num_replicas: settings.num_replicas,
44
+ replica_indexes: settings.replica_indexes,
45
+ bucket_type: settings.bucket_type,
46
+ ejection_policy: settings.ejection_policy,
47
+ max_expiry: settings.max_expiry,
48
+ compression_mode: settings.compression_mode,
49
+ conflict_resolution_type: settings.conflict_resolution_type,
50
+ }, options.timeout
51
51
  )
52
52
  end
53
53
 
@@ -62,17 +62,17 @@ module Couchbase
62
62
  # @raise [Error::BucketNotFound]
63
63
  def update_bucket(settings, options = UpdateBucketOptions.new)
64
64
  @backend.bucket_update(
65
- {
66
- name: settings.name,
67
- flush_enabled: settings.flush_enabled,
68
- ram_quota_mb: settings.ram_quota_mb,
69
- num_replicas: settings.num_replicas,
70
- replica_indexes: settings.replica_indexes,
71
- bucket_type: settings.bucket_type,
72
- ejection_policy: settings.ejection_policy,
73
- max_expiry: settings.max_expiry,
74
- compression_mode: settings.compression_mode,
75
- }, options.timeout
65
+ {
66
+ name: settings.name,
67
+ flush_enabled: settings.flush_enabled,
68
+ ram_quota_mb: settings.ram_quota_mb,
69
+ num_replicas: settings.num_replicas,
70
+ replica_indexes: settings.replica_indexes,
71
+ bucket_type: settings.bucket_type,
72
+ ejection_policy: settings.ejection_policy,
73
+ max_expiry: settings.max_expiry,
74
+ compression_mode: settings.compression_mode,
75
+ }, options.timeout
76
76
  )
77
77
  end
78
78
 
@@ -17,7 +17,7 @@ require "couchbase/errors"
17
17
  module Couchbase
18
18
  module Management
19
19
  class CollectionManager
20
- alias_method :inspect, :to_s
20
+ alias inspect to_s
21
21
 
22
22
  # @param [Couchbase::Backend] backend
23
23
  # @param [String] bucket_name
@@ -55,8 +55,8 @@ module Couchbase
55
55
  #
56
56
  # @raise [Error::ScopeNotFound]
57
57
  def get_scope(scope_name, options = GetScopeOptions.new)
58
- get_all_scopes(GetAllScopesOptions.new {|o| o.timeout = options.timeout })
59
- .find { |scope| scope.name == scope_name } or raise Error::ScopeNotFound, "unable to find scope #{scope_name}"
58
+ get_all_scopes(GetAllScopesOptions.new { |o| o.timeout = options.timeout })
59
+ .find { |scope| scope.name == scope_name } or raise Error::ScopeNotFound, "unable to find scope #{scope_name}"
60
60
  end
61
61
 
62
62
  # Creates a new scope
@@ -17,7 +17,7 @@ require "couchbase/errors"
17
17
  module Couchbase
18
18
  module Management
19
19
  class QueryIndexManager
20
- alias_method :inspect, :to_s
20
+ alias inspect to_s
21
21
 
22
22
  # @param [Couchbase::Backend] backend
23
23
  def initialize(backend)
@@ -40,6 +40,9 @@ module Couchbase
40
40
  index.is_primary = idx[:is_primary]
41
41
  index.type = idx[:type]
42
42
  index.state = idx[:state]
43
+ index.bucket = idx[:bucket_id]
44
+ index.collection = idx[:collection_id]
45
+ index.scope = idx[:scope_id]
43
46
  index.key_space = idx[:keyspace_id]
44
47
  index.name_space = idx[:namespace_id]
45
48
  index.index_key = idx[:index_key]
@@ -61,10 +64,12 @@ module Couchbase
61
64
  # @raise [Error::IndexExists]
62
65
  def create_index(bucket_name, index_name, fields, options = CreateIndexOptions.new)
63
66
  @backend.query_index_create(bucket_name, index_name, fields, {
64
- ignore_if_exists: options.ignore_if_exists,
65
- condition: options.condition,
66
- deferred: options.deferred,
67
- num_replicas: options.num_replicas,
67
+ ignore_if_exists: options.ignore_if_exists,
68
+ condition: options.condition,
69
+ deferred: options.deferred,
70
+ num_replicas: options.num_replicas,
71
+ scope_name: options.scope_name,
72
+ collection_name: options.collection_name,
68
73
  }, options.timeout)
69
74
  end
70
75
 
@@ -79,9 +84,11 @@ module Couchbase
79
84
  # @raise [Error::IndexExists]
80
85
  def create_primary_index(bucket_name, options = CreatePrimaryIndexOptions.new)
81
86
  @backend.query_index_create_primary(bucket_name, {
82
- ignore_if_exists: options.ignore_if_exists,
83
- deferred: options.deferred,
84
- num_replicas: options.num_replicas,
87
+ ignore_if_exists: options.ignore_if_exists,
88
+ deferred: options.deferred,
89
+ num_replicas: options.num_replicas,
90
+ scope_name: options.scope_name,
91
+ collection_name: options.collection_name,
85
92
  }, options.timeout)
86
93
  end
87
94
 
@@ -97,7 +104,9 @@ module Couchbase
97
104
  # @raise [Error::IndexNotFound]
98
105
  def drop_index(bucket_name, index_name, options = DropIndexOptions.new)
99
106
  @backend.query_index_drop(bucket_name, index_name, {
100
- ignore_if_does_not_exist: options.ignore_if_does_not_exist,
107
+ ignore_if_does_not_exist: options.ignore_if_does_not_exist,
108
+ scope_name: options.scope_name,
109
+ collection_name: options.collection_name,
101
110
  }, options.timeout)
102
111
  true
103
112
  end
@@ -113,8 +122,10 @@ module Couchbase
113
122
  # @raise [Error::IndexNotFound]
114
123
  def drop_primary_index(bucket_name, options = DropPrimaryIndexOptions.new)
115
124
  @backend.query_index_drop_primary(bucket_name, {
116
- ignore_if_does_not_exist: options.ignore_if_does_not_exist,
117
- index_name: options.index_name,
125
+ ignore_if_does_not_exist: options.ignore_if_does_not_exist,
126
+ index_name: options.index_name,
127
+ scope_name: options.scope_name,
128
+ collection_name: options.collection_name,
118
129
  }, options.timeout)
119
130
  true
120
131
  end
@@ -141,7 +152,9 @@ module Couchbase
141
152
  # @raise [ArgumentError]
142
153
  # @raise [Error::IndexNotFound]
143
154
  def watch_indexes(bucket_name, index_names, timeout, options = WatchIndexesOptions.new)
144
- @backend.query_index_watch(bucket_name, index_names, timeout, {})
155
+ @backend.query_index_watch(bucket_name, index_names, timeout, {
156
+ watch_primary: options.watch_primary,
157
+ })
145
158
  end
146
159
 
147
160
  class GetAllIndexOptions
@@ -170,6 +183,12 @@ module Couchbase
170
183
  # @return [String] condition to apply to the index
171
184
  attr_accessor :condition
172
185
 
186
+ # @return [String] the name of the scope
187
+ attr_accessor :scope_name
188
+
189
+ # @return [String] the name of the collection
190
+ attr_accessor :collection_name
191
+
173
192
  # @yieldparam [CreateIndexOptions] self
174
193
  def initialize
175
194
  @ignore_if_exists = false
@@ -193,6 +212,12 @@ module Couchbase
193
212
  # @return [Integer] the time in milliseconds allowed for the operation to complete
194
213
  attr_accessor :timeout
195
214
 
215
+ # @return [String] the name of the scope
216
+ attr_accessor :scope_name
217
+
218
+ # @return [String] the name of the collection
219
+ attr_accessor :collection_name
220
+
196
221
  # @yieldparam [CreatePrimaryIndexOptions] self
197
222
  def initialize
198
223
  @ignore_if_exists = false
@@ -207,6 +232,12 @@ module Couchbase
207
232
  # @return [Integer] the time in milliseconds allowed for the operation to complete
208
233
  attr_accessor :timeout
209
234
 
235
+ # @return [String] the name of the scope
236
+ attr_accessor :scope_name
237
+
238
+ # @return [String] the name of the collection
239
+ attr_accessor :collection_name
240
+
210
241
  # @yieldparam [DropIndexOptions] self
211
242
  def initialize
212
243
  @ignore_if_does_not_exist = false
@@ -224,6 +255,12 @@ module Couchbase
224
255
  # @return [Integer] the time in milliseconds allowed for the operation to complete
225
256
  attr_accessor :timeout
226
257
 
258
+ # @return [String] the name of the scope
259
+ attr_accessor :scope_name
260
+
261
+ # @return [String] the name of the collection
262
+ attr_accessor :collection_name
263
+
227
264
  # @yieldparam [DropPrimaryIndexOptions] self
228
265
  def initialize
229
266
  @ignore_if_does_not_exist = false
@@ -258,7 +295,7 @@ module Couchbase
258
295
 
259
296
  # @return [Boolean] true if this is a primary index
260
297
  attr_accessor :is_primary
261
- alias_method :primary?, :is_primary
298
+ alias primary? is_primary
262
299
 
263
300
  # @return [:gsi, :view] type of the index
264
301
  attr_accessor :type
@@ -266,6 +303,15 @@ module Couchbase
266
303
  # @return [Symbol] state
267
304
  attr_accessor :state
268
305
 
306
+ # @return [String, nil] the name of the bucket
307
+ attr_accessor :bucket
308
+
309
+ # @return [String, nil] the name of the scope
310
+ attr_accessor :scope
311
+
312
+ # @return [String, nil] the name of the collection
313
+ attr_accessor :collection
314
+
269
315
  # @return [String] the key space for the index, typically the bucket name.
270
316
  attr_accessor :key_space
271
317
 
@@ -279,7 +325,6 @@ module Couchbase
279
325
  # instance, it will show the indexed fields in an escaped format (surrounded by backticks).
280
326
  attr_accessor :index_key
281
327
 
282
-
283
328
  # @return [String] the string representation of the index's condition (the WHERE clause of the index),
284
329
  # or an empty Optional if no condition was set.
285
330
  #