couchbase 3.6.0-x64-mingw-ucrt

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 (128) 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.so +0 -0
  7. data/lib/couchbase/3.2/libcouchbase.so +0 -0
  8. data/lib/couchbase/3.3/libcouchbase.so +0 -0
  9. data/lib/couchbase/3.4/libcouchbase.so +0 -0
  10. data/lib/couchbase/analytics_options.rb +109 -0
  11. data/lib/couchbase/authenticator.rb +66 -0
  12. data/lib/couchbase/binary_collection.rb +130 -0
  13. data/lib/couchbase/binary_collection_options.rb +26 -0
  14. data/lib/couchbase/bucket.rb +138 -0
  15. data/lib/couchbase/cluster.rb +451 -0
  16. data/lib/couchbase/cluster_registry.rb +49 -0
  17. data/lib/couchbase/collection.rb +664 -0
  18. data/lib/couchbase/collection_options.rb +401 -0
  19. data/lib/couchbase/config_profiles.rb +57 -0
  20. data/lib/couchbase/configuration.rb +58 -0
  21. data/lib/couchbase/datastructures/couchbase_list.rb +160 -0
  22. data/lib/couchbase/datastructures/couchbase_map.rb +194 -0
  23. data/lib/couchbase/datastructures/couchbase_queue.rb +134 -0
  24. data/lib/couchbase/datastructures/couchbase_set.rb +128 -0
  25. data/lib/couchbase/datastructures.rb +26 -0
  26. data/lib/couchbase/deprecations.rb +61 -0
  27. data/lib/couchbase/diagnostics.rb +183 -0
  28. data/lib/couchbase/errors.rb +414 -0
  29. data/lib/couchbase/fork_hooks.rb +32 -0
  30. data/lib/couchbase/json_transcoder.rb +41 -0
  31. data/lib/couchbase/key_value_scan.rb +119 -0
  32. data/lib/couchbase/libcouchbase.rb +6 -0
  33. data/lib/couchbase/logger.rb +87 -0
  34. data/lib/couchbase/management/analytics_index_manager.rb +1129 -0
  35. data/lib/couchbase/management/bucket_manager.rb +451 -0
  36. data/lib/couchbase/management/collection_manager.rb +472 -0
  37. data/lib/couchbase/management/collection_query_index_manager.rb +224 -0
  38. data/lib/couchbase/management/query_index_manager.rb +619 -0
  39. data/lib/couchbase/management/scope_search_index_manager.rb +200 -0
  40. data/lib/couchbase/management/search_index_manager.rb +426 -0
  41. data/lib/couchbase/management/user_manager.rb +470 -0
  42. data/lib/couchbase/management/view_index_manager.rb +239 -0
  43. data/lib/couchbase/management.rb +31 -0
  44. data/lib/couchbase/mutation_state.rb +65 -0
  45. data/lib/couchbase/options.rb +2894 -0
  46. data/lib/couchbase/protostellar/binary_collection.rb +55 -0
  47. data/lib/couchbase/protostellar/bucket.rb +55 -0
  48. data/lib/couchbase/protostellar/client.rb +99 -0
  49. data/lib/couchbase/protostellar/cluster.rb +171 -0
  50. data/lib/couchbase/protostellar/collection.rb +152 -0
  51. data/lib/couchbase/protostellar/connect_options.rb +63 -0
  52. data/lib/couchbase/protostellar/error_handling.rb +203 -0
  53. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +61 -0
  54. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +35 -0
  55. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +57 -0
  56. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +36 -0
  57. data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +61 -0
  58. data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +37 -0
  59. data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +72 -0
  60. data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +44 -0
  61. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +52 -0
  62. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +30 -0
  63. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +70 -0
  64. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +36 -0
  65. data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +97 -0
  66. data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +46 -0
  67. data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +57 -0
  68. data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +30 -0
  69. data/lib/couchbase/protostellar/generated/routing/v1/routing_pb.rb +52 -0
  70. data/lib/couchbase/protostellar/generated/routing/v1/routing_services_pb.rb +30 -0
  71. data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +99 -0
  72. data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +30 -0
  73. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +57 -0
  74. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +36 -0
  75. data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +51 -0
  76. data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +30 -0
  77. data/lib/couchbase/protostellar/generated.rb +9 -0
  78. data/lib/couchbase/protostellar/management/bucket_manager.rb +67 -0
  79. data/lib/couchbase/protostellar/management/collection_manager.rb +94 -0
  80. data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +124 -0
  81. data/lib/couchbase/protostellar/management/query_index_manager.rb +112 -0
  82. data/lib/couchbase/protostellar/management.rb +24 -0
  83. data/lib/couchbase/protostellar/request.rb +78 -0
  84. data/lib/couchbase/protostellar/request_behaviour.rb +42 -0
  85. data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +124 -0
  86. data/lib/couchbase/protostellar/request_generator/admin/collection.rb +94 -0
  87. data/lib/couchbase/protostellar/request_generator/admin/query.rb +130 -0
  88. data/lib/couchbase/protostellar/request_generator/admin.rb +24 -0
  89. data/lib/couchbase/protostellar/request_generator/kv.rb +474 -0
  90. data/lib/couchbase/protostellar/request_generator/query.rb +133 -0
  91. data/lib/couchbase/protostellar/request_generator/search.rb +387 -0
  92. data/lib/couchbase/protostellar/request_generator.rb +26 -0
  93. data/lib/couchbase/protostellar/response_converter/admin/bucket.rb +55 -0
  94. data/lib/couchbase/protostellar/response_converter/admin/collection.rb +42 -0
  95. data/lib/couchbase/protostellar/response_converter/admin/query.rb +59 -0
  96. data/lib/couchbase/protostellar/response_converter/admin.rb +24 -0
  97. data/lib/couchbase/protostellar/response_converter/kv.rb +151 -0
  98. data/lib/couchbase/protostellar/response_converter/query.rb +84 -0
  99. data/lib/couchbase/protostellar/response_converter/search.rb +136 -0
  100. data/lib/couchbase/protostellar/response_converter.rb +26 -0
  101. data/lib/couchbase/protostellar/retry/action.rb +38 -0
  102. data/lib/couchbase/protostellar/retry/orchestrator.rb +60 -0
  103. data/lib/couchbase/protostellar/retry/reason.rb +67 -0
  104. data/lib/couchbase/protostellar/retry/strategies/best_effort.rb +49 -0
  105. data/lib/couchbase/protostellar/retry/strategies.rb +26 -0
  106. data/lib/couchbase/protostellar/retry.rb +28 -0
  107. data/lib/couchbase/protostellar/scope.rb +57 -0
  108. data/lib/couchbase/protostellar/timeout_defaults.rb +30 -0
  109. data/lib/couchbase/protostellar/timeouts.rb +83 -0
  110. data/lib/couchbase/protostellar.rb +29 -0
  111. data/lib/couchbase/query_options.rb +122 -0
  112. data/lib/couchbase/railtie.rb +47 -0
  113. data/lib/couchbase/raw_binary_transcoder.rb +39 -0
  114. data/lib/couchbase/raw_json_transcoder.rb +40 -0
  115. data/lib/couchbase/raw_string_transcoder.rb +42 -0
  116. data/lib/couchbase/scope.rb +258 -0
  117. data/lib/couchbase/search_options.rb +1650 -0
  118. data/lib/couchbase/subdoc.rb +293 -0
  119. data/lib/couchbase/transcoder_flags.rb +64 -0
  120. data/lib/couchbase/utils/generic_logger_adapter.rb +40 -0
  121. data/lib/couchbase/utils/stdlib_logger_adapter.rb +67 -0
  122. data/lib/couchbase/utils/time.rb +71 -0
  123. data/lib/couchbase/utils.rb +23 -0
  124. data/lib/couchbase/version.rb +25 -0
  125. data/lib/couchbase/view_options.rb +67 -0
  126. data/lib/couchbase.rb +32 -0
  127. data/lib/rails/generators/couchbase/config/config_generator.rb +29 -0
  128. metadata +190 -0
@@ -0,0 +1,451 @@
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
+ name: settings.name,
210
+ flush_enabled: settings.flush_enabled,
211
+ ram_quota_mb: settings.ram_quota_mb,
212
+ num_replicas: settings.num_replicas,
213
+ replica_indexes: settings.replica_indexes,
214
+ bucket_type: settings.bucket_type,
215
+ eviction_policy: settings.eviction_policy,
216
+ max_expiry: settings.max_expiry,
217
+ compression_mode: settings.compression_mode,
218
+ minimum_durability_level: settings.minimum_durability_level,
219
+ conflict_resolution_type: settings.conflict_resolution_type,
220
+ storage_backend: settings.storage_backend,
221
+ history_retention_collection_default: settings.history_retention_collection_default,
222
+ history_retention_duration: settings.history_retention_duration,
223
+ history_retention_bytes: settings.history_retention_bytes,
224
+ num_vbuckets: settings.num_vbuckets,
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
+ num_vbuckets: settings.num_vbuckets,
256
+ }, options.to_backend
257
+ )
258
+ end
259
+
260
+ # Removes a bucket
261
+ #
262
+ # @param [String] bucket_name name of the bucket
263
+ # @param [Options::Bucket::DropBucket] options
264
+ #
265
+ # @return void
266
+ #
267
+ # @raise [ArgumentError]
268
+ # @raise [Error::BucketNotFound]
269
+ def drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new)
270
+ @backend.bucket_drop(bucket_name, options.to_backend)
271
+ end
272
+
273
+ # Fetch settings of the bucket
274
+ #
275
+ # @param [String] bucket_name name of the bucket
276
+ # @param [Options::Bucket::GetBucket] options
277
+ #
278
+ # @return [BucketSettings]
279
+ #
280
+ # @raise [ArgumentError]
281
+ # @raise [Error::BucketNotFound]
282
+ def get_bucket(bucket_name, options = Options::Bucket::GetBucket.new)
283
+ extract_bucket_settings(@backend.bucket_get(bucket_name, options.to_backend))
284
+ end
285
+
286
+ # Get settings for all buckets
287
+ #
288
+ # @param [Options::Bucket::GetAllBuckets] options
289
+ # @return [Array<BucketSettings>]
290
+ def get_all_buckets(options = Options::Bucket::GetAllBuckets.new)
291
+ @backend.bucket_get_all(options.to_backend)
292
+ .map { |entry| extract_bucket_settings(entry) }
293
+ end
294
+
295
+ # @param [String] bucket_name name of the bucket
296
+ # @param [Options::Bucket::FlushBucket] options
297
+ #
298
+ # @return void
299
+ #
300
+ # @raise [ArgumentError]
301
+ # @raise [Error::BucketNotFound]
302
+ # @raise [Error::BucketNotFlushable]
303
+ def flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new)
304
+ @backend.bucket_flush(bucket_name, options.to_backend)
305
+ end
306
+
307
+ # @api private
308
+ # TODO: deprecate after 3.2
309
+ CreateBucketOptions = ::Couchbase::Management::Options::Bucket::CreateBucket
310
+
311
+ # @api private
312
+ # TODO: deprecate after 3.2
313
+ UpdateBucketOptions = ::Couchbase::Management::Options::Bucket::UpdateBucket
314
+
315
+ # @api private
316
+ # TODO: deprecate after 3.2
317
+ DropBucketOptions = ::Couchbase::Management::Options::Bucket::DropBucket
318
+
319
+ # @api private
320
+ # TODO: deprecate after 3.2
321
+ GetBucketOptions = ::Couchbase::Management::Options::Bucket::GetBucket
322
+
323
+ # @api private
324
+ # TODO: deprecate after 3.2
325
+ GetAllBucketsOptions = ::Couchbase::Management::Options::Bucket::GetAllBuckets
326
+
327
+ # @api private
328
+ # TODO: deprecate after 3.2
329
+ FlushBucketOptions = ::Couchbase::Management::Options::Bucket::FlushBucket
330
+
331
+ private
332
+
333
+ def extract_bucket_settings(entry)
334
+ BucketSettings.new do |bucket|
335
+ bucket.name = entry[:name]
336
+ bucket.flush_enabled = entry[:flush_enabled]
337
+ bucket.ram_quota_mb = entry[:ram_quota_mb]
338
+ bucket.num_replicas = entry[:num_replicas]
339
+ bucket.replica_indexes = entry[:replica_indexes]
340
+ bucket.bucket_type = entry[:bucket_type]
341
+ bucket.max_expiry = entry[:max_expiry]
342
+ bucket.eviction_policy = entry[:eviction_policy]
343
+ bucket.minimum_durability_level = entry[:minimum_durability_level]
344
+ bucket.compression_mode = entry[:compression_mode]
345
+ bucket.instance_variable_set(:@healthy, entry[:nodes].all? { |node| node[:status] == "healthy" })
346
+ bucket.storage_backend = entry[:storage_backend]
347
+ bucket.history_retention_collection_default = entry[:history_retention_collection_default]
348
+ bucket.history_retention_bytes = entry[:history_retention_bytes]
349
+ bucket.history_retention_duration = entry[:history_retention_duration]
350
+ bucket.num_vbuckets = entry[:num_vbuckets]
351
+ end
352
+ end
353
+ end
354
+
355
+ class BucketSettings
356
+ extend Gem::Deprecate
357
+
358
+ # @return [String] name of the bucket
359
+ attr_accessor :name
360
+
361
+ # @return [Boolean] whether or not flush should be enabled on the bucket. Defaults to false.
362
+ attr_accessor :flush_enabled
363
+
364
+ # @return [Integer] RAM quota in megabytes for the bucket
365
+ attr_accessor :ram_quota_mb
366
+
367
+ # @return [Integer] number of replicas for documents
368
+ attr_accessor :num_replicas
369
+
370
+ # @return [Boolean] whether replica indexes should be enabled for the bucket
371
+ attr_accessor :replica_indexes
372
+
373
+ # @return [:couchbase, :memcached, :ephemeral] the type of the bucket. Defaults to +:couchbase+
374
+ attr_accessor :bucket_type
375
+
376
+ # @return [nil, :couchstore, :magma] the type of the storage backend of the bucket
377
+ attr_accessor :storage_backend
378
+
379
+ # Eviction policy to use
380
+ #
381
+ # :full:: During ejection, only the value will be ejected (key and metadata will remain in memory). Value Ejection
382
+ # needs more system memory, but provides better performance than Full Ejection. This value is only valid for
383
+ # buckets of type +:couchbase+.
384
+ #
385
+ # :value_only:: During ejection, everything (including key, metadata, and value) will be ejected. Full Ejection
386
+ # reduces the memory overhead requirement, at the cost of performance. This value is only valid for
387
+ # buckets of type +:couchbase+.
388
+ #
389
+ # :no_eviction:: Couchbase Server keeps all data until explicitly deleted, but will reject any new data if you
390
+ # reach the quota (dedicated memory) you set for your bucket. This value is only valid for buckets
391
+ # of type +:ephemeral+.
392
+ #
393
+ # :not_recently_used:: When the memory quota is reached, Couchbase Server ejects data that has not been used
394
+ # recently. This value is only valid for buckets of type +:ephemeral+.
395
+ #
396
+ # @return [:full, :value_only, :no_eviction, :not_recently_used] the eviction policy to use
397
+ attr_accessor :eviction_policy
398
+
399
+ # @return [Integer] value of TTL (expiration) in seconds for new documents created without expiration
400
+ attr_accessor :max_expiry
401
+
402
+ # @return [:off, :passive, :active] the compression mode to use
403
+ attr_accessor :compression_mode
404
+
405
+ # @return [:timestamp, :sequence_number, :custom] conflict resolution policy
406
+ attr_accessor :conflict_resolution_type
407
+
408
+ # @return [nil, :none, :majority, :majority_and_persist_to_active, :persist_to_majority] the minimum durability level
409
+ attr_accessor :minimum_durability_level
410
+
411
+ # @return [Boolean, nil] whether to enable history retention on collections by default
412
+ attr_accessor :history_retention_collection_default
413
+
414
+ # @return [Integer, nil] the maximum size, in bytes, of the change history that is written to disk for all
415
+ # collections in this bucket
416
+ attr_accessor :history_retention_bytes
417
+
418
+ # @return [Integer, nil] the maximum duration, in seconds, to be covered by the change history that is written to disk for all
419
+ # collections in this bucket
420
+ attr_accessor :history_retention_duration
421
+
422
+ # @return [Integer, nil] the number of vBuckets the bucket should have. If not set, the server default will be used
423
+ attr_accessor :num_vbuckets
424
+
425
+ # @api private
426
+ # @return [Boolean] false if status of the bucket is not healthy
427
+ def healthy?
428
+ @healthy
429
+ end
430
+
431
+ # @deprecated Use {#eviction_policy} instead
432
+ def ejection_policy
433
+ @eviction_policy
434
+ end
435
+
436
+ deprecate :ejection_policy, :eviction_policy, 2021, 1
437
+
438
+ # @deprecated Use {#eviction_policy=} instead
439
+ def ejection_policy=(val)
440
+ @eviction_policy = val
441
+ end
442
+
443
+ deprecate :ejection_policy=, :eviction_policy=, 2021, 1
444
+
445
+ # @yieldparam [BucketSettings] self
446
+ def initialize
447
+ yield self if block_given?
448
+ end
449
+ end
450
+ end
451
+ end