Class BucketSettings
The BucketSettings interact with the bucket management APIs: BucketManager, ReactiveBucketManager
and AsyncBucketManager, which can be obtained through Cluster.buckets(), ReactiveCluster.buckets()
and AsyncCluster.buckets().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the bucket type.bucketType(BucketType bucketType) Configures theBucketType.Returns theCompressionModeused for the bucket.compressionMode(CompressionMode compressionMode) Sets the compression mode on the bucket.Returns the conflict resolution mode in use.conflictResolutionType(ConflictResolutionType conflictResolutionType) Configures the conflict resolution mode for the bucket.static BucketSettingsCreatesBucketSettingswith the bucket name and all default properties.Deprecated.ejectionPolicy(EjectionPolicy ejectionPolicy) Deprecated.Please useevictionPolicyinstead.Returns the eviction policy used on the bucket.evictionPolicy(EvictionPolicyType evictionPolicy) Allows to configure a customEvictionPolicyTypeas the eviction policy.booleanReturns true if flush is enabled on the bucket.flushEnabled(boolean flushEnabled) Allows enabling flush on the bucket.booleanhealthy()Returns true if the bucket is identified as healthy by the cluster manager.Returns the history retention bytes used on the bucket.historyRetentionBytes(Long historyRetentionBytes) Configures historyRetentionBytes for this bucket.Returns the history retention default used on the bucket.historyRetentionCollectionDefault(Boolean historyRetentionCollectionDefault) Configures historyRetentionCollectionDefault for this bucket.Returns the history retention duration used on the bucket.historyRetentionDuration(Duration historyRetentionDuration) Configures historyRetentionDuration for this bucket.Returns the maximum expiry (time-to-live) for all documents in the bucket.Specifies the maximum expiry (time-to-live) for all documents in the bucket.intmaxTTL()Deprecated.please usemaxExpiry()instead.maxTTL(int maxTTL) Deprecated.please usemaxExpiry(Duration)instead.Returns the minimum durability level set for the bucket.minimumDurabilityLevel(DurabilityLevel durabilityLevel) Configures a custom minimumDurabilityLevelfor this bucket.name()Returns the name of the bucket.intReturns the configured number of replicas.numReplicas(int numReplicas) Sets the number of replica copies for the bucket.@Nullable IntegerReturns the number of virtual buckets (partitions) for this bucket, or null if not applicable or Couchbase Server version is older than 8.0.numVBuckets(@Nullable Integer numVBuckets) Configures the number of virtual buckets (partitions) for this bucket.longReturns the bucket RAM quota in megabytes.ramQuotaMB(long ramQuotaMB) Sets the ram quota in MB for this bucket.booleanReturns the number of replica indexes configured.replicaIndexes(boolean replicaIndexes) Sets the number of replica indexes on the bucket.Returns the storage backend for the bucket.storageBackend(StorageBackend storageBackend) Configures aStorageBackendfor this bucket.toCore()toString()
-
Constructor Details
-
BucketSettings
-
-
Method Details
-
create
CreatesBucketSettingswith the bucket name and all default properties.- Parameters:
name- the name of the bucket.- Returns:
- the
BucketSettingswith all its defaults set.
-
name
Returns the name of the bucket. -
flushEnabled
public boolean flushEnabled()Returns true if flush is enabled on the bucket. -
ramQuotaMB
public long ramQuotaMB()Returns the bucket RAM quota in megabytes. -
numReplicas
public int numReplicas()Returns the configured number of replicas. -
replicaIndexes
public boolean replicaIndexes()Returns the number of replica indexes configured. -
minimumDurabilityLevel
Returns the minimum durability level set for the bucket.Note that if the bucket does not support it, and by default, it is set to
DurabilityLevel.NONE.- Returns:
- the minimum durability level for that bucket.
-
maxExpiry
Returns the maximum expiry (time-to-live) for all documents in the bucket. -
compressionMode
Returns theCompressionModeused for the bucket. -
bucketType
Returns the bucket type. -
conflictResolutionType
Returns the conflict resolution mode in use. -
storageBackend
Returns the storage backend for the bucket. -
historyRetentionDuration
Returns the history retention duration used on the bucket. -
historyRetentionBytes
Returns the history retention bytes used on the bucket. -
historyRetentionCollectionDefault
Returns the history retention default used on the bucket. -
evictionPolicy
Returns the eviction policy used on the bucket. -
healthy
Returns true if the bucket is identified as healthy by the cluster manager. -
flushEnabled
Allows enabling flush on the bucket.- Parameters:
flushEnabled- if flush should be enabled (not recommended for production!).- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
ramQuotaMB
Sets the ram quota in MB for this bucket.- Parameters:
ramQuotaMB- the bucket quota in megabytes.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
numReplicas
Sets the number of replica copies for the bucket.- Parameters:
numReplicas- the number of replicas.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
replicaIndexes
Sets the number of replica indexes on the bucket.- Parameters:
replicaIndexes- the number of replica indexes.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
maxExpiry
Specifies the maximum expiry (time-to-live) for all documents in the bucket.- Parameters:
maxExpiry- the maximum expiry.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
compressionMode
Sets the compression mode on the bucket.- Parameters:
compressionMode- the compression mode to use.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
bucketType
Configures theBucketType.- Parameters:
bucketType- the type of the bucket.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
conflictResolutionType
Configures the conflict resolution mode for the bucket.- Parameters:
conflictResolutionType- the type of conflict resolution to use.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
evictionPolicy
Allows to configure a customEvictionPolicyTypeas the eviction policy.Eviction automatically removes older data from RAM to create space for new data if you reach your bucket quota. How eviction behaves in detail depends on the
BucketTypechosen - please consult the server documentation for more information on the subject.- Parameters:
evictionPolicy- (nullable) policy to use, or null for default policy for theBucketType.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
minimumDurabilityLevel
Configures a custom minimumDurabilityLevelfor this bucket.For
BucketType.COUCHBASE, all durability levels are available. ForBucketType.EPHEMERALonlyDurabilityLevel.NONEandDurabilityLevel.MAJORITYare available. The durability level is not supported on memcached buckets (please use ephemeral buckets instead).- Parameters:
durabilityLevel- the minimum level to use for all KV operations.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
storageBackend
Configures aStorageBackendfor this bucket.Note that
StorageBackend.MAGMAis only supported in 7.0 if developer preview is enabled. It is recommended to be used only with Server 7.1 and later.Also, if a
BucketTypeis chosen that does not have a storage backend attached (i.e.BucketType.MEMCACHEDorBucketType.EPHEMERAL), then this property is ignored.- Parameters:
storageBackend- the backend to use.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
numVBuckets
Configures the number of virtual buckets (partitions) for this bucket.- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
numVBuckets
Returns the number of virtual buckets (partitions) for this bucket, or null if not applicable or Couchbase Server version is older than 8.0. -
historyRetentionCollectionDefault
Configures historyRetentionCollectionDefault for this bucket.- Parameters:
historyRetentionCollectionDefault-- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
historyRetentionBytes
Configures historyRetentionBytes for this bucket.- Parameters:
historyRetentionBytes-- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
historyRetentionDuration
Configures historyRetentionDuration for this bucket.- Parameters:
historyRetentionDuration-- Returns:
- this
BucketSettingsinstance for chaining purposes.
-
maxTTL
Deprecated.please usemaxExpiry()instead.Returns the maximum expiry (time-to-live) for all documents in the bucket in seconds. -
maxTTL
Deprecated.please usemaxExpiry(Duration)instead.Specifies the maximum expiry (time-to-live) for all documents in the bucket in seconds.- Parameters:
maxTTL- the maximum expiry in seconds.- Returns:
- this
BucketSettingsfor chaining purposes.
-
ejectionPolicy
Deprecated.Please useevictionPolicyinstead. -
ejectionPolicy
Deprecated.Please useevictionPolicyinstead.- Parameters:
ejectionPolicy- (nullable) policy to use, or null for default policy for the bucket type.
-
toCore
-
toString
-
evictionPolicyinstead.