couchbase 3.5.2-x86_64-darwin

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 (125) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +202 -0
  3. data/README.md +154 -0
  4. data/ext/extconf.rb +0 -0
  5. data/lib/active_support/cache/couchbase_store.rb +342 -0
  6. data/lib/couchbase/3.1/libcouchbase.bundle +0 -0
  7. data/lib/couchbase/3.2/libcouchbase.bundle +0 -0
  8. data/lib/couchbase/3.3/libcouchbase.bundle +0 -0
  9. data/lib/couchbase/analytics_options.rb +109 -0
  10. data/lib/couchbase/authenticator.rb +66 -0
  11. data/lib/couchbase/binary_collection.rb +130 -0
  12. data/lib/couchbase/binary_collection_options.rb +26 -0
  13. data/lib/couchbase/bucket.rb +146 -0
  14. data/lib/couchbase/cluster.rb +462 -0
  15. data/lib/couchbase/cluster_registry.rb +49 -0
  16. data/lib/couchbase/collection.rb +707 -0
  17. data/lib/couchbase/collection_options.rb +401 -0
  18. data/lib/couchbase/config_profiles.rb +57 -0
  19. data/lib/couchbase/configuration.rb +58 -0
  20. data/lib/couchbase/datastructures/couchbase_list.rb +160 -0
  21. data/lib/couchbase/datastructures/couchbase_map.rb +194 -0
  22. data/lib/couchbase/datastructures/couchbase_queue.rb +134 -0
  23. data/lib/couchbase/datastructures/couchbase_set.rb +128 -0
  24. data/lib/couchbase/datastructures.rb +26 -0
  25. data/lib/couchbase/diagnostics.rb +183 -0
  26. data/lib/couchbase/errors.rb +414 -0
  27. data/lib/couchbase/json_transcoder.rb +41 -0
  28. data/lib/couchbase/key_value_scan.rb +119 -0
  29. data/lib/couchbase/libcouchbase.rb +6 -0
  30. data/lib/couchbase/logger.rb +87 -0
  31. data/lib/couchbase/management/analytics_index_manager.rb +1129 -0
  32. data/lib/couchbase/management/bucket_manager.rb +445 -0
  33. data/lib/couchbase/management/collection_manager.rb +472 -0
  34. data/lib/couchbase/management/collection_query_index_manager.rb +224 -0
  35. data/lib/couchbase/management/query_index_manager.rb +619 -0
  36. data/lib/couchbase/management/scope_search_index_manager.rb +200 -0
  37. data/lib/couchbase/management/search_index_manager.rb +426 -0
  38. data/lib/couchbase/management/user_manager.rb +470 -0
  39. data/lib/couchbase/management/view_index_manager.rb +239 -0
  40. data/lib/couchbase/management.rb +31 -0
  41. data/lib/couchbase/mutation_state.rb +65 -0
  42. data/lib/couchbase/options.rb +2846 -0
  43. data/lib/couchbase/protostellar/binary_collection.rb +55 -0
  44. data/lib/couchbase/protostellar/bucket.rb +55 -0
  45. data/lib/couchbase/protostellar/client.rb +99 -0
  46. data/lib/couchbase/protostellar/cluster.rb +171 -0
  47. data/lib/couchbase/protostellar/collection.rb +152 -0
  48. data/lib/couchbase/protostellar/connect_options.rb +63 -0
  49. data/lib/couchbase/protostellar/error_handling.rb +203 -0
  50. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +61 -0
  51. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +35 -0
  52. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +57 -0
  53. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +36 -0
  54. data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +61 -0
  55. data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +37 -0
  56. data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +72 -0
  57. data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +44 -0
  58. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +52 -0
  59. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +30 -0
  60. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +70 -0
  61. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +36 -0
  62. data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +97 -0
  63. data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +46 -0
  64. data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +57 -0
  65. data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +30 -0
  66. data/lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb +52 -0
  67. data/lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb +30 -0
  68. data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +99 -0
  69. data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +30 -0
  70. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +57 -0
  71. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +36 -0
  72. data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +51 -0
  73. data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +30 -0
  74. data/lib/couchbase/protostellar/generated.rb +9 -0
  75. data/lib/couchbase/protostellar/management/bucket_manager.rb +67 -0
  76. data/lib/couchbase/protostellar/management/collection_manager.rb +94 -0
  77. data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +124 -0
  78. data/lib/couchbase/protostellar/management/query_index_manager.rb +112 -0
  79. data/lib/couchbase/protostellar/management.rb +24 -0
  80. data/lib/couchbase/protostellar/request.rb +78 -0
  81. data/lib/couchbase/protostellar/request_behaviour.rb +42 -0
  82. data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +124 -0
  83. data/lib/couchbase/protostellar/request_generator/admin/collection.rb +94 -0
  84. data/lib/couchbase/protostellar/request_generator/admin/query.rb +130 -0
  85. data/lib/couchbase/protostellar/request_generator/admin.rb +24 -0
  86. data/lib/couchbase/protostellar/request_generator/kv.rb +474 -0
  87. data/lib/couchbase/protostellar/request_generator/query.rb +133 -0
  88. data/lib/couchbase/protostellar/request_generator/search.rb +387 -0
  89. data/lib/couchbase/protostellar/request_generator.rb +26 -0
  90. data/lib/couchbase/protostellar/response_converter/admin/bucket.rb +55 -0
  91. data/lib/couchbase/protostellar/response_converter/admin/collection.rb +42 -0
  92. data/lib/couchbase/protostellar/response_converter/admin/query.rb +59 -0
  93. data/lib/couchbase/protostellar/response_converter/admin.rb +24 -0
  94. data/lib/couchbase/protostellar/response_converter/kv.rb +151 -0
  95. data/lib/couchbase/protostellar/response_converter/query.rb +84 -0
  96. data/lib/couchbase/protostellar/response_converter/search.rb +136 -0
  97. data/lib/couchbase/protostellar/response_converter.rb +26 -0
  98. data/lib/couchbase/protostellar/retry/action.rb +38 -0
  99. data/lib/couchbase/protostellar/retry/orchestrator.rb +60 -0
  100. data/lib/couchbase/protostellar/retry/reason.rb +67 -0
  101. data/lib/couchbase/protostellar/retry/strategies/best_effort.rb +49 -0
  102. data/lib/couchbase/protostellar/retry/strategies.rb +26 -0
  103. data/lib/couchbase/protostellar/retry.rb +28 -0
  104. data/lib/couchbase/protostellar/scope.rb +57 -0
  105. data/lib/couchbase/protostellar/timeout_defaults.rb +30 -0
  106. data/lib/couchbase/protostellar/timeouts.rb +83 -0
  107. data/lib/couchbase/protostellar.rb +29 -0
  108. data/lib/couchbase/query_options.rb +122 -0
  109. data/lib/couchbase/railtie.rb +47 -0
  110. data/lib/couchbase/raw_binary_transcoder.rb +39 -0
  111. data/lib/couchbase/raw_json_transcoder.rb +40 -0
  112. data/lib/couchbase/raw_string_transcoder.rb +42 -0
  113. data/lib/couchbase/scope.rb +258 -0
  114. data/lib/couchbase/search_options.rb +1650 -0
  115. data/lib/couchbase/subdoc.rb +293 -0
  116. data/lib/couchbase/transcoder_flags.rb +64 -0
  117. data/lib/couchbase/utils/generic_logger_adapter.rb +40 -0
  118. data/lib/couchbase/utils/stdlib_logger_adapter.rb +67 -0
  119. data/lib/couchbase/utils/time.rb +71 -0
  120. data/lib/couchbase/utils.rb +23 -0
  121. data/lib/couchbase/version.rb +25 -0
  122. data/lib/couchbase/view_options.rb +67 -0
  123. data/lib/couchbase.rb +30 -0
  124. data/lib/rails/generators/couchbase/config/config_generator.rb +29 -0
  125. metadata +190 -0
@@ -0,0 +1,445 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020-2021 Couchbase, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "rubygems/deprecate"
18
+
19
+ require "couchbase/errors"
20
+ require "couchbase/options"
21
+
22
+ module Couchbase
23
+ module Management
24
+ module Options
25
+ module Bucket
26
+ # Options for {BucketManager#create_bucket}
27
+ class CreateBucket < ::Couchbase::Options::Base
28
+ # Creates an instance of options for {BucketManager#create_bucket}
29
+ #
30
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
31
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
32
+ # @param [Hash, nil] client_context the client context data, if set
33
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
34
+ #
35
+ # @yieldparam [CreateBucket] self
36
+ def initialize(timeout: nil,
37
+ retry_strategy: nil,
38
+ client_context: nil,
39
+ parent_span: nil)
40
+ super
41
+ yield self if block_given?
42
+ end
43
+ end
44
+
45
+ # Options for {BucketManager#update_bucket}
46
+ class UpdateBucket < ::Couchbase::Options::Base
47
+ # Creates an instance of options for {BucketManager#update_bucket}
48
+ #
49
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
50
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
51
+ # @param [Hash, nil] client_context the client context data, if set
52
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
53
+ #
54
+ # @yieldparam [UpdateBucket] self
55
+ def initialize(timeout: nil,
56
+ retry_strategy: nil,
57
+ client_context: nil,
58
+ parent_span: nil)
59
+ super
60
+ yield self if block_given?
61
+ end
62
+ end
63
+
64
+ # Options for {BucketManager#drop_bucket}
65
+ class DropBucket < ::Couchbase::Options::Base
66
+ # Creates an instance of options for {BucketManager#drop_bucket}
67
+ #
68
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
69
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
70
+ # @param [Hash, nil] client_context the client context data, if set
71
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
72
+ #
73
+ # @yieldparam [DropBucket] self
74
+ def initialize(timeout: nil,
75
+ retry_strategy: nil,
76
+ client_context: nil,
77
+ parent_span: nil)
78
+ super
79
+ yield self if block_given?
80
+ end
81
+ end
82
+
83
+ # Options for {BucketManager#get_bucket}
84
+ class GetBucket < ::Couchbase::Options::Base
85
+ # Creates an instance of options for {BucketManager#get_bucket}
86
+ #
87
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
88
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
89
+ # @param [Hash, nil] client_context the client context data, if set
90
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
91
+ #
92
+ # @yieldparam [GetBucket] self
93
+ def initialize(timeout: nil,
94
+ retry_strategy: nil,
95
+ client_context: nil,
96
+ parent_span: nil)
97
+ super
98
+ yield self if block_given?
99
+ end
100
+ end
101
+
102
+ # Options for {BucketManager#get_all_buckets}
103
+ class GetAllBuckets < ::Couchbase::Options::Base
104
+ # Creates an instance of options for {BucketManager#get_all_buckets}
105
+ #
106
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
107
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
108
+ # @param [Hash, nil] client_context the client context data, if set
109
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
110
+ #
111
+ # @yieldparam [GetAllBuckets] self
112
+ def initialize(timeout: nil,
113
+ retry_strategy: nil,
114
+ client_context: nil,
115
+ parent_span: nil)
116
+ super
117
+ yield self if block_given?
118
+ end
119
+ end
120
+
121
+ # Options for {BucketManager#flush_bucket}
122
+ class FlushBucket < ::Couchbase::Options::Base
123
+ # Creates an instance of options for {BucketManager#flush_bucket}
124
+ #
125
+ # @param [Integer, #in_milliseconds, nil] timeout the time in milliseconds allowed for the operation to complete
126
+ # @param [Proc, nil] retry_strategy the custom retry strategy, if set
127
+ # @param [Hash, nil] client_context the client context data, if set
128
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
129
+ #
130
+ # @yieldparam [FlushBucket] self
131
+ def initialize(timeout: nil,
132
+ retry_strategy: nil,
133
+ client_context: nil,
134
+ parent_span: nil)
135
+ super
136
+ yield self if block_given?
137
+ end
138
+ end
139
+
140
+ # rubocop:disable Naming/MethodName constructor shortcuts
141
+ module_function
142
+
143
+ # Construct {CreateBucket} options for {BucketManager#create_bucket}
144
+ #
145
+ # @return [CreateBucket]
146
+ def CreateBucket(**args)
147
+ CreateBucket.new(**args)
148
+ end
149
+
150
+ # Construct {UpdateBucket} options for {BucketManager#update_bucket}
151
+ #
152
+ # @return [UpdateBucket]
153
+ def UpdateBucket(**args)
154
+ UpdateBucket.new(**args)
155
+ end
156
+
157
+ # Construct {DropBucket} options for {BucketManager#drop_bucket}
158
+ #
159
+ # @return [DropBucket]
160
+ def DropBucket(**args)
161
+ DropBucket.new(**args)
162
+ end
163
+
164
+ # Construct {GetBucket} options for {BucketManager#get_bucket}
165
+ #
166
+ # @return [GetBucket]
167
+ def GetBucket(**args)
168
+ GetBucket.new(**args)
169
+ end
170
+
171
+ # Construct {GetAllBuckets} options for {BucketManager#get_all_buckets}
172
+ #
173
+ # @return [GetAllBuckets]
174
+ def GetAllBuckets(**args)
175
+ GetAllBuckets.new(**args)
176
+ end
177
+
178
+ # Construct {FlushBucket} options for {BucketManager#flush_bucket}
179
+ #
180
+ # @return [FlushBucket]
181
+ def FlushBucket(**args)
182
+ FlushBucket.new(**args)
183
+ end
184
+
185
+ # rubocop:enable Naming/MethodName
186
+ end
187
+ end
188
+
189
+ class BucketManager
190
+ alias inspect to_s
191
+
192
+ # @param [Couchbase::Backend] backend
193
+ def initialize(backend)
194
+ @backend = backend
195
+ end
196
+
197
+ # Creates new bucket
198
+ #
199
+ # @param [BucketSettings] settings bucket settings
200
+ # @param [Options::Bucket::CreateBucket] options
201
+ #
202
+ # @return void
203
+ #
204
+ # @raise [ArgumentError]
205
+ # @raise [Error::BucketExists]
206
+ def create_bucket(settings, options = Options::Bucket::CreateBucket.new)
207
+ @backend.bucket_create(
208
+ {
209
+
210
+ name: settings.name,
211
+ flush_enabled: settings.flush_enabled,
212
+ ram_quota_mb: settings.ram_quota_mb,
213
+ num_replicas: settings.num_replicas,
214
+ replica_indexes: settings.replica_indexes,
215
+ bucket_type: settings.bucket_type,
216
+ eviction_policy: settings.eviction_policy,
217
+ max_expiry: settings.max_expiry,
218
+ compression_mode: settings.compression_mode,
219
+ minimum_durability_level: settings.minimum_durability_level,
220
+ conflict_resolution_type: settings.conflict_resolution_type,
221
+ storage_backend: settings.storage_backend,
222
+ history_retention_collection_default: settings.history_retention_collection_default,
223
+ history_retention_duration: settings.history_retention_duration,
224
+ history_retention_bytes: settings.history_retention_bytes,
225
+ }, options.to_backend
226
+ )
227
+ end
228
+
229
+ # Updates the bucket settings
230
+ #
231
+ # @param [BucketSettings] settings bucket settings
232
+ # @param [Options::Bucket::UpdateBucket] options
233
+ #
234
+ # @return void
235
+ #
236
+ # @raise [ArgumentError]
237
+ # @raise [Error::BucketNotFound]
238
+ def update_bucket(settings, options = Options::Bucket::UpdateBucket.new)
239
+ @backend.bucket_update(
240
+ {
241
+ name: settings.name,
242
+ flush_enabled: settings.flush_enabled,
243
+ ram_quota_mb: settings.ram_quota_mb,
244
+ num_replicas: settings.num_replicas,
245
+ replica_indexes: settings.replica_indexes,
246
+ bucket_type: settings.bucket_type,
247
+ eviction_policy: settings.eviction_policy,
248
+ max_expiry: settings.max_expiry,
249
+ compression_mode: settings.compression_mode,
250
+ minimum_durability_level: settings.minimum_durability_level,
251
+ storage_backend: settings.storage_backend,
252
+ history_retention_collection_default: settings.history_retention_collection_default,
253
+ history_retention_bytes: settings.history_retention_bytes,
254
+ history_retention_duration: settings.history_retention_duration,
255
+ }, options.to_backend
256
+ )
257
+ end
258
+
259
+ # Removes a bucket
260
+ #
261
+ # @param [String] bucket_name name of the bucket
262
+ # @param [Options::Bucket::DropBucket] options
263
+ #
264
+ # @return void
265
+ #
266
+ # @raise [ArgumentError]
267
+ # @raise [Error::BucketNotFound]
268
+ def drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new)
269
+ @backend.bucket_drop(bucket_name, options.to_backend)
270
+ end
271
+
272
+ # Fetch settings of the bucket
273
+ #
274
+ # @param [String] bucket_name name of the bucket
275
+ # @param [Options::Bucket::GetBucket] options
276
+ #
277
+ # @return [BucketSettings]
278
+ #
279
+ # @raise [ArgumentError]
280
+ # @raise [Error::BucketNotFound]
281
+ def get_bucket(bucket_name, options = Options::Bucket::GetBucket.new)
282
+ extract_bucket_settings(@backend.bucket_get(bucket_name, options.to_backend))
283
+ end
284
+
285
+ # Get settings for all buckets
286
+ #
287
+ # @param [Options::Bucket::GetAllBuckets] options
288
+ # @return [Array<BucketSettings>]
289
+ def get_all_buckets(options = Options::Bucket::GetAllBuckets.new)
290
+ @backend.bucket_get_all(options.to_backend)
291
+ .map { |entry| extract_bucket_settings(entry) }
292
+ end
293
+
294
+ # @param [String] bucket_name name of the bucket
295
+ # @param [Options::Bucket::FlushBucket] options
296
+ #
297
+ # @return void
298
+ #
299
+ # @raise [ArgumentError]
300
+ # @raise [Error::BucketNotFound]
301
+ # @raise [Error::BucketNotFlushable]
302
+ def flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new)
303
+ @backend.bucket_flush(bucket_name, options.to_backend)
304
+ end
305
+
306
+ # @api private
307
+ # TODO: deprecate after 3.2
308
+ CreateBucketOptions = ::Couchbase::Management::Options::Bucket::CreateBucket
309
+
310
+ # @api private
311
+ # TODO: deprecate after 3.2
312
+ UpdateBucketOptions = ::Couchbase::Management::Options::Bucket::UpdateBucket
313
+
314
+ # @api private
315
+ # TODO: deprecate after 3.2
316
+ DropBucketOptions = ::Couchbase::Management::Options::Bucket::DropBucket
317
+
318
+ # @api private
319
+ # TODO: deprecate after 3.2
320
+ GetBucketOptions = ::Couchbase::Management::Options::Bucket::GetBucket
321
+
322
+ # @api private
323
+ # TODO: deprecate after 3.2
324
+ GetAllBucketsOptions = ::Couchbase::Management::Options::Bucket::GetAllBuckets
325
+
326
+ # @api private
327
+ # TODO: deprecate after 3.2
328
+ FlushBucketOptions = ::Couchbase::Management::Options::Bucket::FlushBucket
329
+
330
+ private
331
+
332
+ def extract_bucket_settings(entry)
333
+ BucketSettings.new do |bucket|
334
+ bucket.name = entry[:name]
335
+ bucket.flush_enabled = entry[:flush_enabled]
336
+ bucket.ram_quota_mb = entry[:ram_quota_mb]
337
+ bucket.num_replicas = entry[:num_replicas]
338
+ bucket.replica_indexes = entry[:replica_indexes]
339
+ bucket.bucket_type = entry[:bucket_type]
340
+ bucket.max_expiry = entry[:max_expiry]
341
+ bucket.eviction_policy = entry[:eviction_policy]
342
+ bucket.minimum_durability_level = entry[:minimum_durability_level]
343
+ bucket.compression_mode = entry[:compression_mode]
344
+ bucket.instance_variable_set(:@healthy, entry[:nodes].all? { |node| node[:status] == "healthy" })
345
+ bucket.history_retention_collection_default = entry[:history_retention_collection_default]
346
+ bucket.history_retention_bytes = entry[:history_retention_bytes]
347
+ bucket.history_retention_duration = entry[:history_retention_duration]
348
+ end
349
+ end
350
+ end
351
+
352
+ class BucketSettings
353
+ extend Gem::Deprecate
354
+
355
+ # @return [String] name of the bucket
356
+ attr_accessor :name
357
+
358
+ # @return [Boolean] whether or not flush should be enabled on the bucket. Defaults to false.
359
+ attr_accessor :flush_enabled
360
+
361
+ # @return [Integer] RAM quota in megabytes for the bucket
362
+ attr_accessor :ram_quota_mb
363
+
364
+ # @return [Integer] number of replicas for documents
365
+ attr_accessor :num_replicas
366
+
367
+ # @return [Boolean] whether replica indexes should be enabled for the bucket
368
+ attr_accessor :replica_indexes
369
+
370
+ # @return [:couchbase, :memcached, :ephemeral] the type of the bucket. Defaults to +:couchbase+
371
+ attr_accessor :bucket_type
372
+
373
+ # @return [nil, :couchstore, :magma] the type of the storage backend of the bucket
374
+ attr_accessor :storage_backend
375
+
376
+ # Eviction policy to use
377
+ #
378
+ # :full:: During ejection, only the value will be ejected (key and metadata will remain in memory). Value Ejection
379
+ # needs more system memory, but provides better performance than Full Ejection. This value is only valid for
380
+ # buckets of type +:couchbase+.
381
+ #
382
+ # :value_only:: During ejection, everything (including key, metadata, and value) will be ejected. Full Ejection
383
+ # reduces the memory overhead requirement, at the cost of performance. This value is only valid for
384
+ # buckets of type +:couchbase+.
385
+ #
386
+ # :no_eviction:: Couchbase Server keeps all data until explicitly deleted, but will reject any new data if you
387
+ # reach the quota (dedicated memory) you set for your bucket. This value is only valid for buckets
388
+ # of type +:ephemeral+.
389
+ #
390
+ # :not_recently_used:: When the memory quota is reached, Couchbase Server ejects data that has not been used
391
+ # recently. This value is only valid for buckets of type +:ephemeral+.
392
+ #
393
+ # @return [:full, :value_only, :no_eviction, :not_recently_used] the eviction policy to use
394
+ attr_accessor :eviction_policy
395
+
396
+ # @return [Integer] value of TTL (expiration) in seconds for new documents created without expiration
397
+ attr_accessor :max_expiry
398
+
399
+ # @return [:off, :passive, :active] the compression mode to use
400
+ attr_accessor :compression_mode
401
+
402
+ # @return [:timestamp, :sequence_number, :custom] conflict resolution policy
403
+ attr_accessor :conflict_resolution_type
404
+
405
+ # @return [nil, :none, :majority, :majority_and_persist_to_active, :persist_to_majority] the minimum durability level
406
+ attr_accessor :minimum_durability_level
407
+
408
+ # @return [Boolean, nil] whether to enable history retention on collections by default
409
+ attr_accessor :history_retention_collection_default
410
+
411
+ # @return [Integer, nil] the maximum size, in bytes, of the change history that is written to disk for all
412
+ # collections in this bucket
413
+ attr_accessor :history_retention_bytes
414
+
415
+ # @return [Integer, nil] the maximum duration, in seconds, to be covered by the change history that is written to disk for all
416
+ # collections in this bucket
417
+ attr_accessor :history_retention_duration
418
+
419
+ # @api private
420
+ # @return [Boolean] false if status of the bucket is not healthy
421
+ def healthy?
422
+ @healthy
423
+ end
424
+
425
+ # @deprecated Use {#eviction_policy} instead
426
+ def ejection_policy
427
+ @eviction_policy
428
+ end
429
+
430
+ deprecate :ejection_policy, :eviction_policy, 2021, 1
431
+
432
+ # @deprecated Use {#eviction_policy=} instead
433
+ def ejection_policy=(val)
434
+ @eviction_policy = val
435
+ end
436
+
437
+ deprecate :ejection_policy=, :eviction_policy=, 2021, 1
438
+
439
+ # @yieldparam [BucketSettings] self
440
+ def initialize
441
+ yield self if block_given?
442
+ end
443
+ end
444
+ end
445
+ end