couchbase 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/CMakeLists.txt +3 -0
  4. data/ext/build_version.hxx.in +1 -1
  5. data/ext/cmake/CompilerWarnings.cmake +1 -0
  6. data/ext/cmake/PreventInSourceBuilds.cmake +4 -1
  7. data/ext/couchbase/bucket.hxx +28 -2
  8. data/ext/couchbase/cluster.hxx +8 -2
  9. data/ext/couchbase/couchbase.cxx +955 -511
  10. data/ext/couchbase/error_context/analytics.hxx +46 -0
  11. data/ext/couchbase/error_context/http.hxx +44 -0
  12. data/ext/couchbase/error_context/key_value.hxx +47 -0
  13. data/ext/couchbase/error_context/query.hxx +46 -0
  14. data/ext/couchbase/error_context/search.hxx +47 -0
  15. data/ext/couchbase/error_context/view.hxx +47 -0
  16. data/ext/couchbase/io/dns_codec.hxx +1 -2
  17. data/ext/couchbase/io/http_command.hxx +16 -3
  18. data/ext/couchbase/io/http_context.hxx +1 -1
  19. data/ext/couchbase/io/http_session.hxx +12 -6
  20. data/ext/couchbase/io/http_session_manager.hxx +25 -24
  21. data/ext/couchbase/io/mcbp_session.hxx +8 -2
  22. data/ext/couchbase/io/retry_context.hxx +1 -1
  23. data/ext/couchbase/operations/analytics_dataset_create.hxx +19 -12
  24. data/ext/couchbase/operations/analytics_dataset_drop.hxx +18 -10
  25. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +16 -10
  26. data/ext/couchbase/operations/analytics_dataverse_create.hxx +18 -11
  27. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +17 -11
  28. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +17 -10
  29. data/ext/couchbase/operations/analytics_index_create.hxx +17 -11
  30. data/ext/couchbase/operations/analytics_index_drop.hxx +16 -10
  31. data/ext/couchbase/operations/analytics_index_get_all.hxx +14 -10
  32. data/ext/couchbase/operations/analytics_link_connect.hxx +15 -9
  33. data/ext/couchbase/operations/analytics_link_disconnect.hxx +16 -10
  34. data/ext/couchbase/operations/bucket_create.hxx +33 -10
  35. data/ext/couchbase/operations/bucket_drop.hxx +9 -8
  36. data/ext/couchbase/operations/bucket_flush.hxx +8 -8
  37. data/ext/couchbase/operations/bucket_get.hxx +15 -10
  38. data/ext/couchbase/operations/bucket_get_all.hxx +14 -7
  39. data/ext/couchbase/operations/bucket_settings.hxx +16 -0
  40. data/ext/couchbase/operations/bucket_update.hxx +32 -10
  41. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +6 -6
  42. data/ext/couchbase/operations/collection_create.hxx +19 -13
  43. data/ext/couchbase/operations/collection_drop.hxx +18 -12
  44. data/ext/couchbase/operations/collections_manifest_get.hxx +5 -10
  45. data/ext/couchbase/operations/document_analytics.hxx +39 -17
  46. data/ext/couchbase/operations/document_append.hxx +5 -10
  47. data/ext/couchbase/operations/document_decrement.hxx +5 -10
  48. data/ext/couchbase/operations/document_exists.hxx +4 -6
  49. data/ext/couchbase/operations/document_get.hxx +6 -10
  50. data/ext/couchbase/operations/document_get_and_lock.hxx +4 -9
  51. data/ext/couchbase/operations/document_get_and_touch.hxx +4 -9
  52. data/ext/couchbase/operations/document_get_projected.hxx +21 -14
  53. data/ext/couchbase/operations/document_increment.hxx +5 -10
  54. data/ext/couchbase/operations/document_insert.hxx +5 -10
  55. data/ext/couchbase/operations/document_lookup_in.hxx +4 -9
  56. data/ext/couchbase/operations/document_mutate_in.hxx +7 -12
  57. data/ext/couchbase/operations/document_prepend.hxx +5 -10
  58. data/ext/couchbase/operations/document_query.hxx +45 -28
  59. data/ext/couchbase/operations/document_remove.hxx +5 -10
  60. data/ext/couchbase/operations/document_replace.hxx +5 -10
  61. data/ext/couchbase/operations/document_search.hxx +37 -16
  62. data/ext/couchbase/operations/document_touch.hxx +4 -9
  63. data/ext/couchbase/operations/document_unlock.hxx +4 -9
  64. data/ext/couchbase/operations/document_upsert.hxx +5 -10
  65. data/ext/couchbase/operations/document_view.hxx +29 -13
  66. data/ext/couchbase/operations/group_drop.hxx +7 -7
  67. data/ext/couchbase/operations/group_get.hxx +14 -10
  68. data/ext/couchbase/operations/group_get_all.hxx +14 -8
  69. data/ext/couchbase/operations/group_upsert.hxx +15 -9
  70. data/ext/couchbase/operations/http_noop.hxx +5 -5
  71. data/ext/couchbase/operations/mcbp_noop.hxx +3 -9
  72. data/ext/couchbase/operations/query_index_build_deferred.hxx +15 -9
  73. data/ext/couchbase/operations/query_index_create.hxx +16 -10
  74. data/ext/couchbase/operations/query_index_drop.hxx +16 -10
  75. data/ext/couchbase/operations/query_index_get_all.hxx +13 -7
  76. data/ext/couchbase/operations/role_get_all.hxx +14 -8
  77. data/ext/couchbase/operations/scope_create.hxx +19 -13
  78. data/ext/couchbase/operations/scope_drop.hxx +17 -11
  79. data/ext/couchbase/operations/scope_get_all.hxx +15 -10
  80. data/ext/couchbase/operations/search_get_stats.hxx +5 -5
  81. data/ext/couchbase/operations/search_index_analyze_document.hxx +25 -13
  82. data/ext/couchbase/operations/search_index_control_ingest.hxx +23 -11
  83. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +23 -11
  84. data/ext/couchbase/operations/search_index_control_query.hxx +23 -11
  85. data/ext/couchbase/operations/search_index_drop.hxx +22 -10
  86. data/ext/couchbase/operations/search_index_get.hxx +22 -10
  87. data/ext/couchbase/operations/search_index_get_all.hxx +13 -7
  88. data/ext/couchbase/operations/search_index_get_documents_count.hxx +24 -13
  89. data/ext/couchbase/operations/search_index_get_stats.hxx +16 -10
  90. data/ext/couchbase/operations/search_index_upsert.hxx +23 -11
  91. data/ext/couchbase/operations/user_drop.hxx +8 -8
  92. data/ext/couchbase/operations/user_get.hxx +14 -10
  93. data/ext/couchbase/operations/user_get_all.hxx +14 -8
  94. data/ext/couchbase/operations/user_upsert.hxx +15 -9
  95. data/ext/couchbase/operations/view_index_drop.hxx +7 -7
  96. data/ext/couchbase/operations/view_index_get.hxx +15 -9
  97. data/ext/couchbase/operations/view_index_get_all.hxx +15 -9
  98. data/ext/couchbase/operations/view_index_upsert.hxx +8 -8
  99. data/ext/couchbase/origin.hxx +1 -0
  100. data/ext/couchbase/platform/terminate_handler.cc +12 -8
  101. data/ext/couchbase/protocol/client_request.hxx +2 -1
  102. data/ext/couchbase/protocol/client_response.hxx +18 -15
  103. data/ext/couchbase/protocol/cmd_exists.hxx +1 -0
  104. data/ext/couchbase/protocol/cmd_get.hxx +1 -1
  105. data/ext/couchbase/protocol/cmd_mutate_in.hxx +3 -4
  106. data/ext/couchbase/protocol/enhanced_error_info.hxx +28 -0
  107. data/ext/couchbase/utils/connection_string.hxx +1 -1
  108. data/ext/couchbase/version.hxx +1 -1
  109. data/ext/extconf.rb +1 -1
  110. data/ext/test/test_native_binary_operations.cxx +18 -18
  111. data/ext/test/test_native_diagnostics.cxx +2 -2
  112. data/ext/test/test_native_trivial_crud.cxx +2 -2
  113. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_reader.hpp +1 -5
  114. data/lib/active_support/cache/couchbase_store.rb +362 -0
  115. data/lib/couchbase.rb +2 -0
  116. data/lib/couchbase/authenticator.rb +26 -0
  117. data/lib/couchbase/binary_collection.rb +1 -0
  118. data/lib/couchbase/bucket.rb +1 -0
  119. data/lib/couchbase/cluster.rb +51 -27
  120. data/lib/couchbase/collection.rb +19 -4
  121. data/lib/couchbase/collection_options.rb +10 -0
  122. data/lib/couchbase/configuration.rb +57 -0
  123. data/lib/couchbase/datastructures.rb +6 -0
  124. data/lib/couchbase/errors.rb +111 -3
  125. data/lib/couchbase/management.rb +27 -0
  126. data/lib/couchbase/management/bucket_manager.rb +9 -2
  127. data/lib/couchbase/management/collection_manager.rb +1 -1
  128. data/lib/couchbase/management/user_manager.rb +18 -2
  129. data/lib/couchbase/options.rb +33 -23
  130. data/lib/couchbase/railtie.rb +45 -0
  131. data/lib/couchbase/scope.rb +44 -3
  132. data/lib/couchbase/utils.rb +21 -0
  133. data/lib/couchbase/utils/time.rb +52 -0
  134. data/lib/couchbase/version.rb +1 -1
  135. data/lib/rails/generators/couchbase/config/config_generator.rb +27 -0
  136. metadata +19 -5
@@ -0,0 +1,27 @@
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Couchbase
16
+ # This namespace includes manager classes to control cluster resources and perform maintenance operations.
17
+ module Management
18
+ end
19
+ end
20
+
21
+ require "couchbase/management/analytics_index_manager"
22
+ require "couchbase/management/bucket_manager"
23
+ require "couchbase/management/collection_manager"
24
+ require "couchbase/management/query_index_manager"
25
+ require "couchbase/management/search_index_manager"
26
+ require "couchbase/management/user_manager"
27
+ require "couchbase/management/view_index_manager"
@@ -48,6 +48,7 @@ module Couchbase
48
48
  ejection_policy: settings.ejection_policy,
49
49
  max_expiry: settings.max_expiry,
50
50
  compression_mode: settings.compression_mode,
51
+ minimum_durability_level: settings.minimum_durability_level,
51
52
  conflict_resolution_type: settings.conflict_resolution_type,
52
53
  }, options.timeout
53
54
  )
@@ -74,6 +75,7 @@ module Couchbase
74
75
  ejection_policy: settings.ejection_policy,
75
76
  max_expiry: settings.max_expiry,
76
77
  compression_mode: settings.compression_mode,
78
+ minimum_durability_level: settings.minimum_durability_level,
77
79
  }, options.timeout
78
80
  )
79
81
  end
@@ -111,7 +113,7 @@ module Couchbase
111
113
  # @return [Array<BucketSettings>]
112
114
  def get_all_buckets(options = GetAllBucketsOptions.new)
113
115
  res = @backend.bucket_get_all(options.timeout)
114
- res.map(&method(:extract_bucket_settings))
116
+ res.map { |entry| extract_bucket_settings(entry) }
115
117
  end
116
118
 
117
119
  # @param [String] bucket_name name of the bucket
@@ -190,7 +192,8 @@ module Couchbase
190
192
  bucket.replica_indexes = entry[:replica_indexes]
191
193
  bucket.bucket_type = entry[:bucket_type]
192
194
  bucket.max_expiry = entry[:max_expiry]
193
- bucket.ejection_policy = entry[:max_expiry]
195
+ bucket.eviction_policy = entry[:eviction_policy]
196
+ bucket.minimum_durability_level = entry[:minimum_durability_level]
194
197
  bucket.compression_mode = entry[:compression_mode]
195
198
  bucket.instance_variable_set("@healthy", entry[:nodes].all? { |node| node[:status] == "healthy" })
196
199
  end
@@ -247,6 +250,9 @@ module Couchbase
247
250
  # @return [:timestamp, :sequence_number] conflict resolution policy
248
251
  attr_accessor :conflict_resolution_type
249
252
 
253
+ # @return [nil, :none, :majority, :majority_and_persist_to_active, :persist_to_majority] the minimum durability level
254
+ attr_accessor :minimum_durability_level
255
+
250
256
  # @api private
251
257
  # @return [Boolean] false if status of the bucket is not healthy
252
258
  def healthy?
@@ -269,6 +275,7 @@ module Couchbase
269
275
  def initialize
270
276
  @bucket_type = :couchbase
271
277
  @name = nil
278
+ @minimum_durability_level = nil
272
279
  @healthy = true
273
280
  @flush_enabled = false
274
281
  @ram_quota_mb = 100
@@ -46,7 +46,7 @@ module Couchbase
46
46
  end
47
47
  end
48
48
 
49
- # Removes a scope
49
+ # Get a scope by name
50
50
  #
51
51
  # @param [String] scope_name name of the scope
52
52
  # @param [GetScopeOptions] options
@@ -45,7 +45,7 @@ module Couchbase
45
45
  # @return [Array<UserAndMetadata>]
46
46
  def get_all_users(options = GetAllUsersOptions.new)
47
47
  resp = @backend.user_get_all(options.domain, options.timeout)
48
- resp.map(&method(:extract_user))
48
+ resp.map { |entry| extract_user(entry) }
49
49
  end
50
50
 
51
51
  # Creates or updates a user
@@ -121,7 +121,7 @@ module Couchbase
121
121
  # @return [Array<Group>]
122
122
  def get_all_groups(options = GetAllGroupsOptions.new)
123
123
  resp = @backend.group_get_all(options.timeout)
124
- resp.map(&method(:extract_group))
124
+ resp.map { |entry| extract_group(entry) }
125
125
  end
126
126
 
127
127
  # Creates or updates a group
@@ -164,6 +164,7 @@ module Couchbase
164
164
  # @return [Integer] the time in milliseconds allowed for the operation to complete
165
165
  attr_accessor :timeout
166
166
 
167
+ # @yieldparam [GetUserOptions] self
167
168
  def initialize
168
169
  @domain = :local
169
170
  yield self if block_given?
@@ -177,6 +178,7 @@ module Couchbase
177
178
  # @return [Integer] the time in milliseconds allowed for the operation to complete
178
179
  attr_accessor :timeout
179
180
 
181
+ # @yieldparam [GetAllUsersOptions] self
180
182
  def initialize
181
183
  @domain = :local
182
184
  yield self if block_given?
@@ -190,6 +192,7 @@ module Couchbase
190
192
  # @return [Integer] the time in milliseconds allowed for the operation to complete
191
193
  attr_accessor :timeout
192
194
 
195
+ # @yieldparam [UpsertUserOptions] self
193
196
  def initialize
194
197
  @domain = :local
195
198
  yield self if block_given?
@@ -203,6 +206,7 @@ module Couchbase
203
206
  # @return [Integer] the time in milliseconds allowed for the operation to complete
204
207
  attr_accessor :timeout
205
208
 
209
+ # @yieldparam [DropUserOptions] self
206
210
  def initialize
207
211
  @domain = :local
208
212
  yield self if block_given?
@@ -213,6 +217,7 @@ module Couchbase
213
217
  # @return [Integer] the time in milliseconds allowed for the operation to complete
214
218
  attr_accessor :timeout
215
219
 
220
+ # @yieldparam [GetRolesOptions] self
216
221
  def initialize
217
222
  yield self if block_given?
218
223
  end
@@ -222,6 +227,7 @@ module Couchbase
222
227
  # @return [Integer] the time in milliseconds allowed for the operation to complete
223
228
  attr_accessor :timeout
224
229
 
230
+ # @yieldparam [GetGroupOptions] self
225
231
  def initialize
226
232
  yield self if block_given?
227
233
  end
@@ -231,6 +237,7 @@ module Couchbase
231
237
  # @return [Integer] the time in milliseconds allowed for the operation to complete
232
238
  attr_accessor :timeout
233
239
 
240
+ # @yieldparam [GetAllGroupsOptions] self
234
241
  def initialize
235
242
  yield self if block_given?
236
243
  end
@@ -240,6 +247,7 @@ module Couchbase
240
247
  # @return [Integer] the time in milliseconds allowed for the operation to complete
241
248
  attr_accessor :timeout
242
249
 
250
+ # @yieldparam [UpsertGroupOptions] self
243
251
  def initialize
244
252
  yield self if block_given?
245
253
  end
@@ -249,6 +257,7 @@ module Couchbase
249
257
  # @return [Integer] the time in milliseconds allowed for the operation to complete
250
258
  attr_accessor :timeout
251
259
 
260
+ # @yieldparam [DropGroupOptions] self
252
261
  def initialize
253
262
  yield self if block_given?
254
263
  end
@@ -327,6 +336,7 @@ module Couchbase
327
336
  # @return [String]
328
337
  attr_accessor :collection
329
338
 
339
+ # @yieldparam [Role] self
330
340
  def initialize
331
341
  yield self if block_given?
332
342
  end
@@ -339,6 +349,7 @@ module Couchbase
339
349
  # @return [String]
340
350
  attr_accessor :description
341
351
 
352
+ # @yieldparam [RoleAndDescription] self
342
353
  def initialize
343
354
  super
344
355
  yield self if block_given?
@@ -352,6 +363,7 @@ module Couchbase
352
363
  # @return [String]
353
364
  attr_writer :name
354
365
 
366
+ # @yieldparam [Origin] self
355
367
  def initialize
356
368
  yield self if block_given?
357
369
  end
@@ -361,6 +373,7 @@ module Couchbase
361
373
  # @return [Array<Origin>]
362
374
  attr_writer :origins
363
375
 
376
+ # @yieldparam [RoleAndOrigins] self
364
377
  def initialize
365
378
  super
366
379
  @origins = []
@@ -384,6 +397,7 @@ module Couchbase
384
397
  # @return [String]
385
398
  attr_accessor :password
386
399
 
400
+ # @yieldparam [User] self
387
401
  def initialize
388
402
  @groups = []
389
403
  @roles = []
@@ -404,6 +418,7 @@ module Couchbase
404
418
  # @return [Array<String>]
405
419
  attr_accessor :external_groups
406
420
 
421
+ # @yieldparam [UserAndMetadata] self
407
422
  def initialize
408
423
  super
409
424
  @effective_roles = []
@@ -424,6 +439,7 @@ module Couchbase
424
439
  # @return [String]
425
440
  attr_accessor :ldap_group_reference
426
441
 
442
+ # @yieldparam [Group] self
427
443
  def initialize
428
444
  @roles = []
429
445
  yield self if block_given?
@@ -1,4 +1,4 @@
1
- # Copyright 2020 Couchbase, Inc.
1
+ # Copyright 2020-2021 Couchbase, Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require "couchbase/utils/time"
16
+
15
17
  module Couchbase
16
18
  # Definition of the Option classes for data APIs
17
19
  module Options # rubocop:disable Metrics/ModuleLength
@@ -454,7 +456,7 @@ module Couchbase
454
456
 
455
457
  # Creates an instance of options for {Collection#insert}
456
458
  #
457
- # @param [Integer, #in_seconds, nil] expiry expiration time to associate with the document
459
+ # @param [Integer, #in_seconds, Time, nil] expiry expiration time to associate with the document
458
460
  # @param [JsonTranscoder, #encode(Object)] transcoder used for encoding
459
461
  # @param [Symbol] durability_level level of durability
460
462
  # +:none+::
@@ -484,7 +486,7 @@ module Couchbase
484
486
  client_context: nil,
485
487
  parent_span: nil)
486
488
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
487
- @expiry = expiry
489
+ @expiry = Utils::Time.extract_expiry_time(expiry)
488
490
  @transcoder = transcoder
489
491
  @durability_level = durability_level
490
492
  yield self if block_given?
@@ -494,7 +496,7 @@ module Couchbase
494
496
  def to_backend
495
497
  {
496
498
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
497
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
499
+ expiry: @expiry,
498
500
  durability_level: @durability_level,
499
501
  }
500
502
  end
@@ -508,7 +510,7 @@ module Couchbase
508
510
 
509
511
  # Creates an instance of options for {Collection#upsert}
510
512
  #
511
- # @param [Integer, #in_seconds, nil] expiry expiration time to associate with the document
513
+ # @param [Integer, #in_seconds, Time, nil] expiry expiration time to associate with the document
512
514
  # @param [JsonTranscoder, #encode(Object)] transcoder used for encoding
513
515
  # @param [Symbol] durability_level level of durability
514
516
  # +:none+::
@@ -538,7 +540,7 @@ module Couchbase
538
540
  client_context: nil,
539
541
  parent_span: nil)
540
542
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
541
- @expiry = expiry
543
+ @expiry = Utils::Time.extract_expiry_time(expiry)
542
544
  @transcoder = transcoder
543
545
  @durability_level = durability_level
544
546
  yield self if block_given?
@@ -547,7 +549,7 @@ module Couchbase
547
549
  def to_backend
548
550
  {
549
551
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
550
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
552
+ expiry: @expiry,
551
553
  durability_level: @durability_level,
552
554
  }
553
555
  end
@@ -561,7 +563,7 @@ module Couchbase
561
563
 
562
564
  # Creates an instance of options for {Collection#upsert}
563
565
  #
564
- # @param [Integer, #in_seconds, nil] expiry expiration time to associate with the document
566
+ # @param [Integer, #in_seconds, Time, nil] expiry expiration time to associate with the document
565
567
  # @param [JsonTranscoder, #encode(Object)] transcoder used for encoding
566
568
  # @param [Symbol] durability_level level of durability
567
569
  # +:none+::
@@ -591,7 +593,7 @@ module Couchbase
591
593
  client_context: nil,
592
594
  parent_span: nil)
593
595
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
594
- @expiry = expiry
596
+ @expiry = Utils::Time.extract_expiry_time(expiry)
595
597
  @transcoder = transcoder
596
598
  @durability_level = durability_level
597
599
  yield self if block_given?
@@ -600,7 +602,7 @@ module Couchbase
600
602
  def to_backend
601
603
  {
602
604
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
603
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
605
+ expiry: @expiry,
604
606
  durability_level: @durability_level,
605
607
  }
606
608
  end
@@ -647,7 +649,7 @@ module Couchbase
647
649
  client_context: nil,
648
650
  parent_span: nil)
649
651
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
650
- @expiry = expiry
652
+ @expiry = Utils::Time.extract_expiry_time(expiry)
651
653
  @transcoder = transcoder
652
654
  @cas = cas
653
655
  @durability_level = durability_level
@@ -657,7 +659,7 @@ module Couchbase
657
659
  def to_backend
658
660
  {
659
661
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
660
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
662
+ expiry: @expiry,
661
663
  durability_level: @durability_level,
662
664
  cas: @cas,
663
665
  }
@@ -676,7 +678,7 @@ module Couchbase
676
678
 
677
679
  # Creates an instance of options for {Collection#mutate_in}
678
680
  #
679
- # @param [Integer, #in_seconds, nil] expiry expiration time to associate with the document
681
+ # @param [Integer, #in_seconds, Time, nil] expiry expiration time to associate with the document
680
682
  # @param [Symbol] store_semantics describes how the outer document store semantics on subdoc should act
681
683
  # +:replace+:: replace the document, fail if it does not exist. This is the default
682
684
  # +:upsert+:: replace the document or create if it does not exist
@@ -717,7 +719,7 @@ module Couchbase
717
719
  client_context: nil,
718
720
  parent_span: nil)
719
721
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
720
- @expiry = expiry
722
+ @expiry = Utils::Time.extract_expiry_time(expiry)
721
723
  @store_semantics = store_semantics
722
724
  @cas = cas
723
725
  @access_deleted = access_deleted
@@ -731,7 +733,7 @@ module Couchbase
731
733
  def to_backend
732
734
  {
733
735
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
734
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
736
+ expiry: @expiry,
735
737
  durability_level: @durability_level,
736
738
  cas: @cas,
737
739
  store_semantics: @store_semantics,
@@ -856,7 +858,7 @@ module Couchbase
856
858
  #
857
859
  # @param [Integer] delta the delta for the operation
858
860
  # @param [Integer] initial if present, holds the initial value
859
- # @param [Integer, #in_seconds] expiry if set, holds the expiration for the operation
861
+ # @param [Integer, #in_seconds, Time, nil] expiry if set, holds the expiration for the operation
860
862
  # @param [Symbol] durability_level level of durability
861
863
  # +:none+::
862
864
  # no enhanced durability required for the mutation
@@ -890,7 +892,7 @@ module Couchbase
890
892
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
891
893
  @delta = delta
892
894
  @initial = initial
893
- @expiry = expiry
895
+ @expiry = Utils::Time.extract_expiry_time(expiry)
894
896
  @durability_level = durability_level
895
897
  yield self if block_given?
896
898
  end
@@ -908,7 +910,7 @@ module Couchbase
908
910
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
909
911
  delta: @delta,
910
912
  initial_value: @initial,
911
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
913
+ expiry: @expiry,
912
914
  durability_level: @durability_level,
913
915
  }
914
916
  end
@@ -925,7 +927,7 @@ module Couchbase
925
927
  #
926
928
  # @param [Integer] delta the delta for the operation
927
929
  # @param [Integer] initial if present, holds the initial value
928
- # @param [Integer, #in_seconds] expiry if set, holds the expiration for the operation
930
+ # @param [Integer, #in_seconds, Time, nil] expiry if set, holds the expiration for the operation
929
931
  # @param [Symbol] durability_level level of durability
930
932
  # +:none+::
931
933
  # no enhanced durability required for the mutation
@@ -959,7 +961,7 @@ module Couchbase
959
961
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
960
962
  @delta = delta
961
963
  @initial = initial
962
- @expiry = expiry
964
+ @expiry = Utils::Time.extract_expiry_time(expiry)
963
965
  @durability_level = durability_level
964
966
  yield self if block_given?
965
967
  end
@@ -977,7 +979,7 @@ module Couchbase
977
979
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
978
980
  delta: @delta,
979
981
  initial_value: @initial,
980
- expiry: @expiry.respond_to?(:in_seconds) ? @expiry.public_send(:in_seconds) : @expiry,
982
+ expiry: @expiry,
981
983
  durability_level: @durability_level,
982
984
  }
983
985
  end
@@ -1166,6 +1168,7 @@ module Couchbase
1166
1168
  attr_accessor :readonly # @return [Boolean]
1167
1169
  attr_accessor :priority # @return [Boolean]
1168
1170
  attr_accessor :transcoder # @return [JsonTranscoder, #decode(String)]
1171
+ attr_accessor :scope_qualifier # @return [String]
1169
1172
 
1170
1173
  # Creates new instance of options for {Couchbase::Cluster#analytics_query}
1171
1174
  #
@@ -1191,6 +1194,8 @@ module Couchbase
1191
1194
  # like +$1+, +$2+ in query string
1192
1195
  # @param [Hash<String => #to_json>, nil] named_parameters parameters to be used as substitution for named macros
1193
1196
  # like +$name+ in query string
1197
+ # @param [String, nil] scope_qualifier Associate scope qualifier (also known as +query_context+) with the query.
1198
+ # The qualifier must be in form +{bucket_name}.{scope_name}+ or +default:{bucket_name}.{scope_name}+.
1194
1199
  #
1195
1200
  # @param [Integer, #in_milliseconds, nil] timeout
1196
1201
  # @param [Proc, nil] retry_strategy the custom retry strategy, if set
@@ -1207,6 +1212,7 @@ module Couchbase
1207
1212
  transcoder: JsonTranscoder.new,
1208
1213
  positional_parameters: nil,
1209
1214
  named_parameters: nil,
1215
+ scope_qualifier: nil,
1210
1216
  timeout: nil,
1211
1217
  retry_strategy: nil,
1212
1218
  client_context: nil,
@@ -1221,6 +1227,7 @@ module Couchbase
1221
1227
  @transcoder = transcoder
1222
1228
  @positional_parameters = positional_parameters
1223
1229
  @named_parameters = named_parameters
1230
+ @scope_qualifier = scope_qualifier
1224
1231
  @raw_parameters = {}
1225
1232
  yield self if block_given?
1226
1233
  end
@@ -1250,7 +1257,7 @@ module Couchbase
1250
1257
  end
1251
1258
 
1252
1259
  # @api private
1253
- def to_backend
1260
+ def to_backend(scope_name: nil, bucket_name: nil)
1254
1261
  {
1255
1262
  timeout: @timeout.respond_to?(:in_milliseconds) ? @timeout.public_send(:in_milliseconds) : @timeout,
1256
1263
  client_context_id: @client_context_id,
@@ -1260,6 +1267,9 @@ module Couchbase
1260
1267
  positional_parameters: export_positional_parameters,
1261
1268
  named_parameters: export_named_parameters,
1262
1269
  raw_parameters: @raw_parameters,
1270
+ scope_qualifier: @scope_qualifier,
1271
+ scope_name: scope_name,
1272
+ bucket_name: bucket_name,
1263
1273
  }
1264
1274
  end
1265
1275
 
@@ -1337,7 +1347,7 @@ module Couchbase
1337
1347
  # +:request_plus+::
1338
1348
  # The indexer will wait until all mutations have been processed at the time of request before returning to
1339
1349
  # the query engine.
1340
- # @return [Boolean, nil] flex_index Tells the query engine to use a flex index (utilizing the search service)
1350
+ # @param [Boolean, nil] flex_index Tells the query engine to use a flex index (utilizing the search service)
1341
1351
  # @param [String, nil] scope_qualifier Associate scope qualifier (also known as +query_context+) with the query.
1342
1352
  # The qualifier must be in form +{bucket_name}.{scope_name}+ or +default:{bucket_name}.{scope_name}+.
1343
1353
  # @param [JsonTranscoder] transcoder to decode rows