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
-
Method Summary
Modifier and TypeMethodDescriptionReturns the bucket type.bucketType
(BucketType bucketType) Configures theBucketType
.Returns theCompressionMode
used 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 BucketSettings
CreatesBucketSettings
with the bucket name and all default properties.Deprecated.ejectionPolicy
(EjectionPolicy ejectionPolicy) Deprecated.Please useevictionPolicy
instead.Returns the eviction policy used on the bucket.evictionPolicy
(EvictionPolicyType evictionPolicy) Allows to configure a customEvictionPolicyType
as the eviction policy.boolean
Returns true if flush is enabled on the bucket.flushEnabled
(boolean flushEnabled) Allows enabling flush on the bucket.boolean
healthy()
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.int
maxTTL()
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 minimumDurabilityLevel
for this bucket.name()
Returns the name of the bucket.int
Returns the configured number of replicas.numReplicas
(int numReplicas) Sets the number of replica copies for the bucket.long
Returns the bucket RAM quota in megabytes.ramQuotaMB
(long ramQuotaMB) Sets the ram quota in MB for this bucket.boolean
Returns 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 aStorageBackend
for this bucket.toCore()
toString()
-
Constructor Details
-
BucketSettings
-
-
Method Details
-
create
CreatesBucketSettings
with the bucket name and all default properties.- Parameters:
name
- the name of the bucket.- Returns:
- the
BucketSettings
with 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 theCompressionMode
used 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
BucketSettings
instance for chaining purposes.
-
ramQuotaMB
Sets the ram quota in MB for this bucket.- Parameters:
ramQuotaMB
- the bucket quota in megabytes.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
numReplicas
Sets the number of replica copies for the bucket.- Parameters:
numReplicas
- the number of replicas.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
replicaIndexes
Sets the number of replica indexes on the bucket.- Parameters:
replicaIndexes
- the number of replica indexes.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
maxExpiry
Specifies the maximum expiry (time-to-live) for all documents in the bucket.- Parameters:
maxExpiry
- the maximum expiry.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
compressionMode
Sets the compression mode on the bucket.- Parameters:
compressionMode
- the compression mode to use.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
bucketType
Configures theBucketType
.- Parameters:
bucketType
- the type of the bucket.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
conflictResolutionType
Configures the conflict resolution mode for the bucket.- Parameters:
conflictResolutionType
- the type of conflict resolution to use.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
evictionPolicy
Allows to configure a customEvictionPolicyType
as 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
BucketType
chosen - 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
BucketSettings
instance for chaining purposes.
-
minimumDurabilityLevel
Configures a custom minimumDurabilityLevel
for this bucket.For
BucketType.COUCHBASE
, all durability levels are available. ForBucketType.EPHEMERAL
onlyDurabilityLevel.NONE
andDurabilityLevel.MAJORITY
are 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
BucketSettings
instance for chaining purposes.
-
storageBackend
Configures aStorageBackend
for this bucket.Note that
StorageBackend.MAGMA
is 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
BucketType
is chosen that does not have a storage backend attached (i.e.BucketType.MEMCACHED
orBucketType.EPHEMERAL
), then this property is ignored.- Parameters:
storageBackend
- the backend to use.- Returns:
- this
BucketSettings
instance for chaining purposes.
-
historyRetentionCollectionDefault
Configures historyRetentionCollectionDefault for this bucket.- Parameters:
historyRetentionCollectionDefault
-- Returns:
- this
BucketSettings
instance for chaining purposes.
-
historyRetentionBytes
Configures historyRetentionBytes for this bucket.- Parameters:
historyRetentionBytes
-- Returns:
- this
BucketSettings
instance for chaining purposes.
-
historyRetentionDuration
Configures historyRetentionDuration for this bucket.- Parameters:
historyRetentionDuration
-- Returns:
- this
BucketSettings
instance 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
BucketSettings
for chaining purposes.
-
ejectionPolicy
Deprecated.Please useevictionPolicy
instead. -
ejectionPolicy
Deprecated.Please useevictionPolicy
instead.- Parameters:
ejectionPolicy
- (nullable) policy to use, or null for default policy for the bucket type.
-
toCore
-
toString
-
evictionPolicy
instead.