public class BucketSettings extends Object
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 and Description |
---|
BucketSettings(com.couchbase.client.core.manager.bucket.CoreBucketSettings internal) |
Modifier and Type | Method and Description |
---|---|
BucketType |
bucketType()
Returns the bucket type.
|
BucketSettings |
bucketType(BucketType bucketType)
Configures the
BucketType . |
CompressionMode |
compressionMode()
Returns the
CompressionMode used for the bucket. |
BucketSettings |
compressionMode(CompressionMode compressionMode)
Sets the compression mode on the bucket.
|
ConflictResolutionType |
conflictResolutionType()
Returns the conflict resolution mode in use.
|
BucketSettings |
conflictResolutionType(ConflictResolutionType conflictResolutionType)
Configures the conflict resolution mode for the bucket.
|
static BucketSettings |
create(String name)
Creates
BucketSettings with the bucket name and all default properties. |
EjectionPolicy |
ejectionPolicy()
Deprecated.
Please use
evictionPolicy instead. |
BucketSettings |
ejectionPolicy(EjectionPolicy ejectionPolicy)
Deprecated.
Please use
evictionPolicy instead. |
EvictionPolicyType |
evictionPolicy()
Returns the eviction policy used on the bucket.
|
BucketSettings |
evictionPolicy(EvictionPolicyType evictionPolicy)
Allows to configure a custom
EvictionPolicyType as the eviction policy. |
boolean |
flushEnabled()
Returns true if flush is enabled on the bucket.
|
BucketSettings |
flushEnabled(boolean flushEnabled)
Allows enabling flush on the bucket.
|
boolean |
healthy()
Returns true if the bucket is identified as healthy by the cluster manager.
|
Long |
historyRetentionBytes()
Returns the history retention bytes used on the bucket.
|
BucketSettings |
historyRetentionBytes(Long historyRetentionBytes)
Configures historyRetentionBytes for this bucket.
|
Boolean |
historyRetentionCollectionDefault()
Returns the history retention default used on the bucket.
|
BucketSettings |
historyRetentionCollectionDefault(Boolean historyRetentionCollectionDefault)
Configures historyRetentionCollectionDefault for this bucket.
|
Duration |
historyRetentionDuration()
Returns the history retention duration used on the bucket.
|
BucketSettings |
historyRetentionDuration(Duration historyRetentionDuration)
Configures historyRetentionDuration for this bucket.
|
Duration |
maxExpiry()
Returns the maximum expiry (time-to-live) for all documents in the bucket.
|
BucketSettings |
maxExpiry(Duration maxExpiry)
Specifies the maximum expiry (time-to-live) for all documents in the bucket.
|
int |
maxTTL()
Deprecated.
please use
maxExpiry() instead. |
BucketSettings |
maxTTL(int maxTTL)
Deprecated.
please use
maxExpiry(Duration) instead. |
com.couchbase.client.core.msg.kv.DurabilityLevel |
minimumDurabilityLevel()
Returns the minimum durability level set for the bucket.
|
BucketSettings |
minimumDurabilityLevel(com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel)
Configures a custom minimum
DurabilityLevel for this bucket. |
String |
name()
Returns the name of the bucket.
|
int |
numReplicas()
Returns the configured number of replicas.
|
BucketSettings |
numReplicas(int numReplicas)
Sets the number of replica copies for the bucket.
|
long |
ramQuotaMB()
Returns the bucket RAM quota in megabytes.
|
BucketSettings |
ramQuotaMB(long ramQuotaMB)
Sets the ram quota in MB for this bucket.
|
boolean |
replicaIndexes()
Returns the number of replica indexes configured.
|
BucketSettings |
replicaIndexes(boolean replicaIndexes)
Sets the number of replica indexes on the bucket.
|
StorageBackend |
storageBackend()
Returns the storage backend for the bucket.
|
BucketSettings |
storageBackend(StorageBackend storageBackend)
Configures a
StorageBackend for this bucket. |
com.couchbase.client.core.manager.bucket.CoreBucketSettings |
toCore() |
String |
toString() |
@Stability.Internal public BucketSettings(com.couchbase.client.core.manager.bucket.CoreBucketSettings internal)
public static BucketSettings create(String name)
BucketSettings
with the bucket name and all default properties.name
- the name of the bucket.BucketSettings
with all its defaults set.public String name()
public boolean flushEnabled()
public long ramQuotaMB()
public int numReplicas()
public boolean replicaIndexes()
public com.couchbase.client.core.msg.kv.DurabilityLevel minimumDurabilityLevel()
Note that if the bucket does not support it, and by default, it is set to DurabilityLevel.NONE
.
public Duration maxExpiry()
public CompressionMode compressionMode()
CompressionMode
used for the bucket.public BucketType bucketType()
public ConflictResolutionType conflictResolutionType()
public StorageBackend storageBackend()
public Duration historyRetentionDuration()
public Long historyRetentionBytes()
public Boolean historyRetentionCollectionDefault()
public EvictionPolicyType evictionPolicy()
@Stability.Internal public boolean healthy()
public BucketSettings flushEnabled(boolean flushEnabled)
flushEnabled
- if flush should be enabled (not recommended for production!).BucketSettings
instance for chaining purposes.public BucketSettings ramQuotaMB(long ramQuotaMB)
ramQuotaMB
- the bucket quota in megabytes.BucketSettings
instance for chaining purposes.public BucketSettings numReplicas(int numReplicas)
numReplicas
- the number of replicas.BucketSettings
instance for chaining purposes.public BucketSettings replicaIndexes(boolean replicaIndexes)
replicaIndexes
- the number of replica indexes.BucketSettings
instance for chaining purposes.public BucketSettings maxExpiry(Duration maxExpiry)
maxExpiry
- the maximum expiry.BucketSettings
instance for chaining purposes.public BucketSettings compressionMode(CompressionMode compressionMode)
compressionMode
- the compression mode to use.BucketSettings
instance for chaining purposes.public BucketSettings bucketType(BucketType bucketType)
BucketType
.bucketType
- the type of the bucket.BucketSettings
instance for chaining purposes.public BucketSettings conflictResolutionType(ConflictResolutionType conflictResolutionType)
conflictResolutionType
- the type of conflict resolution to use.BucketSettings
instance for chaining purposes.public BucketSettings evictionPolicy(EvictionPolicyType evictionPolicy)
EvictionPolicyType
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.
evictionPolicy
- (nullable) policy to use, or null for default policy for the BucketType
.BucketSettings
instance for chaining purposes.public BucketSettings minimumDurabilityLevel(com.couchbase.client.core.msg.kv.DurabilityLevel durabilityLevel)
DurabilityLevel
for this bucket.
For BucketType.COUCHBASE
, all durability levels are available. For BucketType.EPHEMERAL
only
DurabilityLevel.NONE
and DurabilityLevel.MAJORITY
are available. The durability level is not
supported on memcached buckets (please use ephemeral buckets instead).
durabilityLevel
- the minimum level to use for all KV operations.BucketSettings
instance for chaining purposes.public BucketSettings storageBackend(StorageBackend storageBackend)
StorageBackend
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
or BucketType.EPHEMERAL
), then this property is ignored.
storageBackend
- the backend to use.BucketSettings
instance for chaining purposes.public BucketSettings historyRetentionCollectionDefault(Boolean historyRetentionCollectionDefault)
historyRetentionCollectionDefault
- BucketSettings
instance for chaining purposes.public BucketSettings historyRetentionBytes(Long historyRetentionBytes)
historyRetentionBytes
- BucketSettings
instance for chaining purposes.public BucketSettings historyRetentionDuration(Duration historyRetentionDuration)
historyRetentionDuration
- BucketSettings
instance for chaining purposes.@Deprecated public int maxTTL()
maxExpiry()
instead.@Deprecated public BucketSettings maxTTL(int maxTTL)
maxExpiry(Duration)
instead.maxTTL
- the maximum expiry in seconds.BucketSettings
for chaining purposes.@Deprecated public EjectionPolicy ejectionPolicy()
evictionPolicy
instead.@Deprecated public BucketSettings ejectionPolicy(EjectionPolicy ejectionPolicy)
evictionPolicy
instead.ejectionPolicy
- (nullable) policy to use, or null for default policy for the bucket type.@Stability.Internal public com.couchbase.client.core.manager.bucket.CoreBucketSettings toCore()
Copyright © 2024 Couchbase, Inc.. All rights reserved.