Class: Couchbase::Management::BucketManager
- Inherits:
-
Object
- Object
- Couchbase::Management::BucketManager
- Defined in:
- lib/couchbase/management/bucket_manager.rb
Defined Under Namespace
Classes: CreateBucketOptions, DropBucketOptions, FlushBucketOptions, GetAllBucketsOptions, GetBucketOptions, UpdateBucketOptions
Instance Method Summary collapse
-
#create_bucket(settings, options = CreateBucketOptions.new) ⇒ Object
Creates new bucket.
-
#drop_bucket(bucket_name, options = DropBucketOptions.new) ⇒ Object
Removes a bucket.
-
#flush_bucket(bucket_name, options = FlushBucketOptions.new) ⇒ Object
Void.
-
#get_all_buckets(options = GetAllBucketsOptions.new) ⇒ Array<BucketSettings>
Get settings for all buckets.
-
#get_bucket(bucket_name, options = GetBucketOptions.new) ⇒ BucketSettings
Fetch settings of the bucket.
-
#initialize(backend) ⇒ BucketManager
constructor
A new instance of BucketManager.
-
#update_bucket(settings, options = UpdateBucketOptions.new) ⇒ Object
Updates the bucket settings.
Constructor Details
#initialize(backend) ⇒ BucketManager
Returns a new instance of BucketManager.
23 24 25 |
# File 'lib/couchbase/management/bucket_manager.rb', line 23 def initialize(backend) @backend = backend end |
Instance Method Details
#create_bucket(settings, options = CreateBucketOptions.new) ⇒ Object
Creates new bucket
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/couchbase/management/bucket_manager.rb', line 36 def create_bucket(settings, = CreateBucketOptions.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, ejection_policy: settings.ejection_policy, max_expiry: settings.max_expiry, compression_mode: settings.compression_mode, conflict_resolution_type: settings.conflict_resolution_type, }, .timeout ) end |
#drop_bucket(bucket_name, options = DropBucketOptions.new) ⇒ Object
Removes a bucket
88 89 90 |
# File 'lib/couchbase/management/bucket_manager.rb', line 88 def drop_bucket(bucket_name, = DropBucketOptions.new) @backend.bucket_drop(bucket_name, .timeout) end |
#flush_bucket(bucket_name, options = FlushBucketOptions.new) ⇒ Object
Returns void.
122 123 124 |
# File 'lib/couchbase/management/bucket_manager.rb', line 122 def flush_bucket(bucket_name, = FlushBucketOptions.new) @backend.bucket_flush(bucket_name, .timeout) end |
#get_all_buckets(options = GetAllBucketsOptions.new) ⇒ Array<BucketSettings>
Get settings for all buckets
110 111 112 113 |
# File 'lib/couchbase/management/bucket_manager.rb', line 110 def get_all_buckets( = GetAllBucketsOptions.new) res = @backend.bucket_get_all(.timeout) res.map(&method(:extract_bucket_settings)) end |
#get_bucket(bucket_name, options = GetBucketOptions.new) ⇒ BucketSettings
Fetch settings of the bucket
101 102 103 104 |
# File 'lib/couchbase/management/bucket_manager.rb', line 101 def get_bucket(bucket_name, = GetBucketOptions.new) res = @backend.bucket_get(bucket_name, .timeout) extract_bucket_settings(res) end |
#update_bucket(settings, options = UpdateBucketOptions.new) ⇒ Object
Updates the bucket settings
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/couchbase/management/bucket_manager.rb', line 63 def update_bucket(settings, = UpdateBucketOptions.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, ejection_policy: settings.ejection_policy, max_expiry: settings.max_expiry, compression_mode: settings.compression_mode, }, .timeout ) end |