Class: Couchbase::Management::BucketManager
- Inherits:
-
Object
- Object
- Couchbase::Management::BucketManager
- Defined in:
- lib/couchbase/management/bucket_manager.rb
Constant Summary collapse
- CreateBucketOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::CreateBucket
- UpdateBucketOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::UpdateBucket
- DropBucketOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::DropBucket
- GetBucketOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::GetBucket
- GetAllBucketsOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::GetAllBuckets
- FlushBucketOptions =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
TODO: deprecate after 3.2
::Couchbase::Management::Options::Bucket::FlushBucket
Instance Method Summary collapse
-
#create_bucket(settings, options = Options::Bucket::CreateBucket.new) ⇒ Object
Creates new bucket.
-
#drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new) ⇒ Object
Removes a bucket.
-
#flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new) ⇒ Object
Void.
-
#get_all_buckets(options = Options::Bucket::GetAllBuckets.new) ⇒ Array<BucketSettings>
Get settings for all buckets.
-
#get_bucket(bucket_name, options = Options::Bucket::GetBucket.new) ⇒ BucketSettings
Fetch settings of the bucket.
-
#initialize(backend, observability) ⇒ BucketManager
constructor
private
A new instance of BucketManager.
-
#update_bucket(settings, options = Options::Bucket::UpdateBucket.new) ⇒ Object
Updates the bucket settings.
Constructor Details
#initialize(backend, observability) ⇒ BucketManager
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BucketManager.
196 197 198 199 |
# File 'lib/couchbase/management/bucket_manager.rb', line 196 def initialize(backend, observability) @backend = backend @observability = observability end |
Instance Method Details
#create_bucket(settings, options = Options::Bucket::CreateBucket.new) ⇒ Object
Creates new bucket
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/couchbase/management/bucket_manager.rb', line 210 def create_bucket(settings, = Options::Bucket::CreateBucket.new) @observability.record_operation(Observability::OP_BM_CREATE_BUCKET, .parent_span, self, :management) do |obs_handler| obs_handler.add_bucket_name(settings.name) @backend.bucket_create( { name: settings.name, flush_enabled: settings.flush_enabled, ram_quota_mb: settings.ram_quota_mb, num_replicas: settings.num_replicas, replica_indexes: settings.replica_indexes, bucket_type: settings.bucket_type, eviction_policy: settings.eviction_policy, max_expiry: settings.max_expiry, compression_mode: settings.compression_mode, minimum_durability_level: settings.minimum_durability_level, conflict_resolution_type: settings.conflict_resolution_type, storage_backend: settings.storage_backend, history_retention_collection_default: settings.history_retention_collection_default, history_retention_duration: settings.history_retention_duration, history_retention_bytes: settings.history_retention_bytes, num_vbuckets: settings.num_vbuckets, }, .to_backend, obs_handler, ) end end |
#drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new) ⇒ Object
Removes a bucket
285 286 287 288 289 290 291 |
# File 'lib/couchbase/management/bucket_manager.rb', line 285 def drop_bucket(bucket_name, = Options::Bucket::DropBucket.new) @observability.record_operation(Observability::OP_BM_DROP_BUCKET, .parent_span, self, :management) do |obs_handler| obs_handler.add_bucket_name(bucket_name) @backend.bucket_drop(bucket_name, .to_backend, obs_handler) end end |
#flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new) ⇒ Object
Returns void.
329 330 331 332 333 |
# File 'lib/couchbase/management/bucket_manager.rb', line 329 def flush_bucket(bucket_name, = Options::Bucket::FlushBucket.new) @observability.record_operation(Observability::OP_BM_FLUSH_BUCKET, .parent_span, self, :management) do |obs_handler| @backend.bucket_flush(bucket_name, .to_backend, obs_handler) end end |
#get_all_buckets(options = Options::Bucket::GetAllBuckets.new) ⇒ Array<BucketSettings>
Get settings for all buckets
314 315 316 317 318 319 |
# File 'lib/couchbase/management/bucket_manager.rb', line 314 def get_all_buckets( = Options::Bucket::GetAllBuckets.new) @observability.record_operation(Observability::OP_BM_GET_ALL_BUCKETS, .parent_span, self, :management) do |obs_handler| @backend.bucket_get_all(.to_backend, obs_handler) .map { |entry| extract_bucket_settings(entry) } end end |
#get_bucket(bucket_name, options = Options::Bucket::GetBucket.new) ⇒ BucketSettings
Fetch settings of the bucket
302 303 304 305 306 307 308 |
# File 'lib/couchbase/management/bucket_manager.rb', line 302 def get_bucket(bucket_name, = Options::Bucket::GetBucket.new) @observability.record_operation(Observability::OP_BM_GET_BUCKET, .parent_span, self, :management) do |obs_handler| obs_handler.add_bucket_name(bucket_name) extract_bucket_settings(@backend.bucket_get(bucket_name, .to_backend, obs_handler)) end end |
#update_bucket(settings, options = Options::Bucket::UpdateBucket.new) ⇒ Object
Updates the bucket settings
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/couchbase/management/bucket_manager.rb', line 248 def update_bucket(settings, = Options::Bucket::UpdateBucket.new) @observability.record_operation(Observability::OP_BM_UPDATE_BUCKET, .parent_span, self, :management) do |obs_handler| obs_handler.add_bucket_name(settings.name) @backend.bucket_update( { name: settings.name, flush_enabled: settings.flush_enabled, ram_quota_mb: settings.ram_quota_mb, num_replicas: settings.num_replicas, replica_indexes: settings.replica_indexes, bucket_type: settings.bucket_type, eviction_policy: settings.eviction_policy, max_expiry: settings.max_expiry, compression_mode: settings.compression_mode, minimum_durability_level: settings.minimum_durability_level, storage_backend: settings.storage_backend, history_retention_collection_default: settings.history_retention_collection_default, history_retention_bytes: settings.history_retention_bytes, history_retention_duration: settings.history_retention_duration, num_vbuckets: settings.num_vbuckets, }, .to_backend, obs_handler, ) end end |