couchbase 3.4.4-arm64-darwin-20 → 3.4.5-arm64-darwin-20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 114c1f905e9873c1e6c8ae96badf29c0c795c9dc653a66584ec41415b5a504c3
4
- data.tar.gz: 7993c632a1513ab6359a91063bc22ce8aaf6402be1353f0fb0f7c2a975f5e57d
3
+ metadata.gz: 57331d93037221ed8fbe9284f153ea87233e09a777c2640490720502fa774706
4
+ data.tar.gz: e9efa936c5c41ed691f9814ad9a9e32df4d27f3e2ff1c87b7e8aa6a68de399c8
5
5
  SHA512:
6
- metadata.gz: 8220a5639d0c7b74b2a6376371ef495239178a49f29b836a6f902569c7f0491ab7df09fb6e049639ed7e6aeb21ee9c6fac145208cfff23095cc428cd1b12651b
7
- data.tar.gz: 42c503acdc73e22ad85f346e56e47b7edc0d8b30c5887a5d8b2d2280e8e1edd288f19e09d8c1c294f422a559fb5970d8d6257e292aafb2045260fbd831ae5483
6
+ metadata.gz: 38ad5e1953b01fec6f2019fd523a19dce4aefb58312f649164d36b7cfdcee9e6fa177e0183afbc92cc6d8a237392a8db8d9fdae059bf162c9cfd6ee36d0ff774
7
+ data.tar.gz: aec1ea54457a8483a993e7551e37e79c49f090e483c265738c4db7c8f3d4263cb1c845308c349ca4c13dd54e13d3be002d98a54a4ff3d32988281cb6385905d5
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.4"
26
+ gem "couchbase", "3.4.5"
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -169,7 +169,6 @@ module Couchbase
169
169
  field = get_field_at_index(path_or_index)
170
170
 
171
171
  raise field.error unless field.error.nil?
172
- raise Error::PathNotFound, "Path is not found: #{path_or_index}" unless field.exists
173
172
 
174
173
  transcoder.decode(field.value, :json)
175
174
  end
@@ -191,7 +190,7 @@ module Couchbase
191
190
  end
192
191
  return false unless field
193
192
 
194
- raise field.error unless field.error.nil?
193
+ raise field.error unless field.error.nil? || field.error.is_a?(Error::PathNotFound)
195
194
 
196
195
  field.exists
197
196
  end
Binary file
@@ -211,12 +211,15 @@ module Couchbase
211
211
  num_replicas: settings.num_replicas,
212
212
  replica_indexes: settings.replica_indexes,
213
213
  bucket_type: settings.bucket_type,
214
- ejection_policy: settings.ejection_policy,
214
+ eviction_policy: settings.eviction_policy,
215
215
  max_expiry: settings.max_expiry,
216
216
  compression_mode: settings.compression_mode,
217
217
  minimum_durability_level: settings.minimum_durability_level,
218
218
  conflict_resolution_type: settings.conflict_resolution_type,
219
219
  storage_backend: settings.storage_backend,
220
+ history_retention_collection_default: settings.history_retention_collection_default,
221
+ history_retention_duration: settings.history_retention_duration,
222
+ history_retention_bytes: settings.history_retention_bytes,
220
223
  }, options.to_backend
221
224
  )
222
225
  end
@@ -239,11 +242,14 @@ module Couchbase
239
242
  num_replicas: settings.num_replicas,
240
243
  replica_indexes: settings.replica_indexes,
241
244
  bucket_type: settings.bucket_type,
242
- ejection_policy: settings.ejection_policy,
245
+ eviction_policy: settings.eviction_policy,
243
246
  max_expiry: settings.max_expiry,
244
247
  compression_mode: settings.compression_mode,
245
248
  minimum_durability_level: settings.minimum_durability_level,
246
249
  storage_backend: settings.storage_backend,
250
+ history_retention_collection_default: settings.history_retention_collection_default,
251
+ history_retention_bytes: settings.history_retention_bytes,
252
+ history_retention_duration: settings.history_retention_duration,
247
253
  }, options.to_backend
248
254
  )
249
255
  end
@@ -334,6 +340,9 @@ module Couchbase
334
340
  bucket.minimum_durability_level = entry[:minimum_durability_level]
335
341
  bucket.compression_mode = entry[:compression_mode]
336
342
  bucket.instance_variable_set(:@healthy, entry[:nodes].all? { |node| node[:status] == "healthy" })
343
+ bucket.history_retention_collection_default = entry[:history_retention_collection_default]
344
+ bucket.history_retention_bytes = entry[:history_retention_bytes]
345
+ bucket.history_retention_duration = entry[:history_retention_duration]
337
346
  end
338
347
  end
339
348
  end
@@ -394,6 +403,17 @@ module Couchbase
394
403
  # @return [nil, :none, :majority, :majority_and_persist_to_active, :persist_to_majority] the minimum durability level
395
404
  attr_accessor :minimum_durability_level
396
405
 
406
+ # @return [Boolean, nil] whether to enable history retention on collections by default
407
+ attr_accessor :history_retention_collection_default
408
+
409
+ # @return [Integer, nil] the maximum size, in bytes, of the change history that is written to disk for all
410
+ # collections in this bucket
411
+ attr_accessor :history_retention_bytes
412
+
413
+ # @return [Integer, nil] the maximum duration, in seconds, to be covered by the change history that is written to disk for all
414
+ # collections in this bucket
415
+ attr_accessor :history_retention_duration
416
+
397
417
  # @api private
398
418
  # @return [Boolean] false if status of the bucket is not healthy
399
419
  def healthy?
@@ -416,19 +436,6 @@ module Couchbase
416
436
 
417
437
  # @yieldparam [BucketSettings] self
418
438
  def initialize
419
- @bucket_type = :couchbase
420
- @name = nil
421
- @minimum_durability_level = nil
422
- @healthy = true
423
- @flush_enabled = false
424
- @ram_quota_mb = 100
425
- @num_replicas = 1
426
- @replica_indexes = false
427
- @max_expiry = 0
428
- @compression_mode = :passive
429
- @conflict_resolution_type = :sequence_number
430
- @eviction_policy = :value_only
431
- @storage_backend = nil
432
439
  yield self if block_given?
433
440
  end
434
441
  end
@@ -38,6 +38,8 @@ module Couchbase
38
38
  super
39
39
  yield self if block_given?
40
40
  end
41
+
42
+ DEFAULT = GetAllScopes.new.freeze
41
43
  end
42
44
 
43
45
  # Options for {CollectionManager#create_scope}
@@ -57,6 +59,8 @@ module Couchbase
57
59
  super
58
60
  yield self if block_given?
59
61
  end
62
+
63
+ DEFAULT = CreateScope.new.freeze
60
64
  end
61
65
 
62
66
  # Options for {CollectionManager#drop_scope}
@@ -76,6 +80,8 @@ module Couchbase
76
80
  super
77
81
  yield self if block_given?
78
82
  end
83
+
84
+ DEFAULT = DropScope.new.freeze
79
85
  end
80
86
 
81
87
  # Options for {CollectionManager#create_collection}
@@ -95,6 +101,29 @@ module Couchbase
95
101
  super
96
102
  yield self if block_given?
97
103
  end
104
+
105
+ DEFAULT = CreateCollection.new.freeze
106
+ end
107
+
108
+ # Options for {CollectionManager#update_collection}
109
+ class UpdateCollection < ::Couchbase::Options::Base
110
+ # Creates an instance of options for {CollectionManager#update_collection}
111
+ #
112
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
113
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
114
+ # @param [Hash, nil] client_context the client context data, if set
115
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
116
+ #
117
+ # @yieldparam [UpdateCollection] self
118
+ def initialize(timeout: nil,
119
+ retry_strategy: nil,
120
+ client_context: nil,
121
+ parent_span: nil)
122
+ super
123
+ yield self if block_given?
124
+ end
125
+
126
+ DEFAULT = UpdateCollection.new.freeze
98
127
  end
99
128
 
100
129
  # Options for {CollectionManager#drop_collection}
@@ -114,6 +143,8 @@ module Couchbase
114
143
  super
115
144
  yield self if block_given?
116
145
  end
146
+
147
+ DEFAULT = DropCollection.new.freeze
117
148
  end
118
149
 
119
150
  # rubocop:disable Naming/MethodName constructor shortcuts
@@ -184,6 +215,8 @@ module Couchbase
184
215
  CollectionSpec.new do |collection|
185
216
  collection.name = c[:name]
186
217
  collection.scope_name = s[:name]
218
+ collection.max_expiry = c[:max_expiry]
219
+ collection.history = c[:history]
187
220
  end
188
221
  end
189
222
  end
@@ -232,29 +265,88 @@ module Couchbase
232
265
  end
233
266
 
234
267
  # Creates a new collection
268
+ # @overload create_collection(scope_name, collection_name, settings = CreateCollectionSettings::DEFAULT,
269
+ # options = Options::Collection::CreateCollection::DEFAULT)
270
+ # @param [String] scope_name the name of the scope the collection will be created in
271
+ # @param [String] collection_name the name of the collection to be created
272
+ # @param [CreateCollectionSettings] settings settings for the new collection
273
+ # @param [Options::Collection::CreateCollection] options
235
274
  #
236
- # @param [CollectionSpec] collection specification of the collection
237
- # @param [Options::Collection::CreateCollection] options
275
+ # @overload create_collection(collection, options = Options::Collection::CreateCollection)
276
+ # @param [CollectionSpec] collection specification of the collection
277
+ # @param [Options::Collection::CreateCollection] options
278
+ #
279
+ # @deprecated Use +#create_collection(scope_name, collection_name, settings, options)+ instead
238
280
  #
239
281
  # @return void
240
282
  #
241
283
  # @raise [ArgumentError]
242
- # @raise [Error::CollectionExist]
284
+ # @raise [Error::CollectionExists]
285
+ # @raise [Error::ScopeNotFound]
286
+ def create_collection(*args)
287
+ if args[0].is_a?(CollectionSpec)
288
+ collection = args[0]
289
+ options = args[1] || Options::Collection::CreateCollection::DEFAULT
290
+ settings = CreateCollectionSettings.new(max_expiry: collection.max_expiry, history: collection.history)
291
+
292
+ warn "Calling create_collection with a CollectionSpec object has been deprecated, supply scope name, " \
293
+ "collection name and optionally a CreateCollectionSettings instance"
294
+
295
+ @backend.collection_create(@bucket_name, collection.scope_name, collection.name, settings.to_backend, options.to_backend)
296
+ else
297
+ scope_name = args[0]
298
+ collection_name = args[1]
299
+ settings = args[2] || CreateCollectionSettings::DEFAULT
300
+ options = args[3] || Options::Collection::CreateCollection::DEFAULT
301
+ @backend.collection_create(@bucket_name, scope_name, collection_name, settings.to_backend, options.to_backend)
302
+ end
303
+ end
304
+
305
+ # Updates the settings of an existing collection
306
+ #
307
+ # @param [String] scope_name the name of the scope the collection is in
308
+ # @param [String] collection_name the name of the collection to be updated
309
+ # @param [UpdateCollectionSettings] settings the settings that should be updated
310
+ #
311
+ # @raise [ArgumentError]
312
+ # @raise [Error::CollectionNotFound]
243
313
  # @raise [Error::ScopeNotFound]
244
- def create_collection(collection, options = Options::Collection::CreateCollection.new)
245
- @backend.collection_create(@bucket_name, collection.scope_name, collection.name, collection.max_expiry, options.to_backend)
314
+ def update_collection(scope_name, collection_name, settings = UpdateCollectionSettings::DEFAULT,
315
+ options = Options::Collection::UpdateCollection::DEFAULT)
316
+ @backend.collection_update(@bucket_name, scope_name, collection_name, settings.to_backend, options.to_backend)
246
317
  end
247
318
 
248
319
  # Removes a collection
320
+ # @overload drop_collection(scope_name, collection_name, settings = CreateCollectionSettings::DEFAULT,
321
+ # options = Options::Collection::CreateCollection::DEFAULT)
322
+ # @param [String] scope_name the name of the scope the collection is in
323
+ # @param [String] collection_name the name of the collection to be removed
249
324
  #
250
- # @param [CollectionSpec] collection specification of the collection
251
- # @param [Options::Collection::DropCollection] options
325
+ # @overload drop_collection(collection, options = Options::Collection::CreateCollection)
326
+ # @param [CollectionSpec] collection specification of the collection
327
+ # @param [Options::Collection::CreateCollection] options
328
+ #
329
+ # @deprecated Use +#drop_collection(scope_name, collection_name, options)+ instead
252
330
  #
253
331
  # @return void
254
332
  #
333
+ # @raise [ArgumentError]
255
334
  # @raise [Error::CollectionNotFound]
256
- def drop_collection(collection, options = Options::Collection::DropCollection.new)
257
- @backend.collection_drop(@bucket_name, collection.scope_name, collection.name, options.to_backend)
335
+ # @raise [Error::ScopeNotFound]
336
+ def drop_collection(*args)
337
+ if args[0].is_a?(CollectionSpec)
338
+ collection = args[0]
339
+ options = args[1] || Options::Collection::CreateCollection::DEFAULT
340
+
341
+ warn "Calling drop_collection with a CollectionSpec object has been deprecated, supply scope name and collection name"
342
+
343
+ @backend.collection_drop(@bucket_name, collection.scope_name, collection.name, options.to_backend)
344
+ else
345
+ scope_name = args[0]
346
+ collection_name = args[1]
347
+ options = args[2] || Options::Collection::CreateCollection::DEFAULT
348
+ @backend.collection_drop(@bucket_name, scope_name, collection_name, options.to_backend)
349
+ end
258
350
  end
259
351
 
260
352
  # @deprecated use {CollectionManager#get_all_scopes} instead
@@ -289,6 +381,60 @@ module Couchbase
289
381
  DropCollectionOptions = ::Couchbase::Management::Options::Collection::DropCollection
290
382
  end
291
383
 
384
+ class CreateCollectionSettings
385
+ # @return [Integer, nil] time in seconds of the maximum expiration time for new documents in the collection
386
+ # (set to +nil+ to disable it)
387
+ attr_accessor :max_expiry
388
+
389
+ # @return [Boolean, nil] whether history retention override should be enabled in the collection (set to +nil+ to
390
+ # default to the bucket-level setting)
391
+ attr_accessor :history
392
+
393
+ def initialize(max_expiry: nil, history: nil)
394
+ @max_expiry = max_expiry
395
+ @history = history
396
+
397
+ yield self if block_given?
398
+ end
399
+
400
+ # @api private
401
+ def to_backend
402
+ {
403
+ max_expiry: @max_expiry,
404
+ history: @history,
405
+ }
406
+ end
407
+
408
+ DEFAULT = CreateCollectionSettings.new.freeze
409
+ end
410
+
411
+ class UpdateCollectionSettings
412
+ # @return [Integer, nil] time in seconds of the maximum expiration time for new documents in the collection
413
+ # (set to +nil+ to disable it)
414
+ attr_accessor :max_expiry
415
+
416
+ # @return [Boolean, nil] whether history retention override should be enabled in the collection (set to +nil+ to
417
+ # default to the bucket-level setting)
418
+ attr_accessor :history
419
+
420
+ def initialize(max_expiry: nil, history: nil)
421
+ @max_expiry = max_expiry
422
+ @history = history
423
+
424
+ yield self if block_given?
425
+ end
426
+
427
+ # @api private
428
+ def to_backend
429
+ {
430
+ max_expiry: @max_expiry,
431
+ history: @history,
432
+ }
433
+ end
434
+
435
+ DEFAULT = UpdateCollectionSettings.new.freeze
436
+ end
437
+
292
438
  class ScopeSpec
293
439
  # @return [String] name of the scope
294
440
  attr_accessor :name
@@ -312,6 +458,9 @@ module Couchbase
312
458
  # @return [Integer] time in seconds of the expiration for new documents in the collection (set to +nil+ to disable it)
313
459
  attr_accessor :max_expiry
314
460
 
461
+ # @return [Boolean, nil] whether history retention is enabled for this collection
462
+ attr_accessor :history
463
+
315
464
  # @yieldparam [CollectionSpec] self
316
465
  def initialize
317
466
  yield self if block_given?
@@ -19,5 +19,5 @@ module Couchbase
19
19
  # $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
20
20
  # {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
21
21
  VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
22
- VERSION.update(:sdk => "3.4.4".freeze)
22
+ VERSION.update(:sdk => "3.4.5".freeze)
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.4
4
+ version: 3.4.5
5
5
  platform: arm64-darwin-20
6
6
  authors:
7
7
  - Sergey Avseyev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Modern SDK for Couchbase Server
14
14
  email:
@@ -78,9 +78,9 @@ metadata:
78
78
  homepage_uri: https://docs.couchbase.com/ruby-sdk/current/hello-world/start-using-sdk.html
79
79
  bug_tracker_uri: https://couchbase.com/issues/browse/RCBC
80
80
  mailing_list_uri: https://forums.couchbase.com/c/ruby-sdk
81
- source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.4.4
82
- changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.4.4
83
- documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.4.4/index.html
81
+ source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.4.5
82
+ changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.4.5
83
+ documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.4.5/index.html
84
84
  github_repo: ssh://github.com/couchbase/couchbase-ruby-client
85
85
  rubygems_mfa_required: 'true'
86
86
  post_install_message: