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) ⇒ BucketManager
constructor
A new instance of BucketManager.
-
#update_bucket(settings, options = Options::Bucket::UpdateBucket.new) ⇒ Object
Updates the bucket settings.
Constructor Details
#initialize(backend) ⇒ BucketManager
Returns a new instance of BucketManager.
193 194 195 |
# File 'lib/couchbase/management/bucket_manager.rb', line 193 def initialize(backend) @backend = backend end |
Instance Method Details
#create_bucket(settings, options = Options::Bucket::CreateBucket.new) ⇒ Object
Creates new bucket
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/couchbase/management/bucket_manager.rb', line 206 def create_bucket(settings, = Options::Bucket::CreateBucket.new) @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, }, .to_backend ) end |
#drop_bucket(bucket_name, options = Options::Bucket::DropBucket.new) ⇒ Object
Removes a bucket
268 269 270 |
# File 'lib/couchbase/management/bucket_manager.rb', line 268 def drop_bucket(bucket_name, = Options::Bucket::DropBucket.new) @backend.bucket_drop(bucket_name, .to_backend) end |
#flush_bucket(bucket_name, options = Options::Bucket::FlushBucket.new) ⇒ Object
Returns void.
302 303 304 |
# File 'lib/couchbase/management/bucket_manager.rb', line 302 def flush_bucket(bucket_name, = Options::Bucket::FlushBucket.new) @backend.bucket_flush(bucket_name, .to_backend) end |
#get_all_buckets(options = Options::Bucket::GetAllBuckets.new) ⇒ Array<BucketSettings>
Get settings for all buckets
289 290 291 292 |
# File 'lib/couchbase/management/bucket_manager.rb', line 289 def get_all_buckets( = Options::Bucket::GetAllBuckets.new) @backend.bucket_get_all(.to_backend) .map { |entry| extract_bucket_settings(entry) } end |
#get_bucket(bucket_name, options = Options::Bucket::GetBucket.new) ⇒ BucketSettings
Fetch settings of the bucket
281 282 283 |
# File 'lib/couchbase/management/bucket_manager.rb', line 281 def get_bucket(bucket_name, = Options::Bucket::GetBucket.new) extract_bucket_settings(@backend.bucket_get(bucket_name, .to_backend)) end |
#update_bucket(settings, options = Options::Bucket::UpdateBucket.new) ⇒ Object
Updates the bucket settings
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/couchbase/management/bucket_manager.rb', line 238 def update_bucket(settings, = Options::Bucket::UpdateBucket.new) @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, }, .to_backend ) end |