Class BucketDefinition

java.lang.Object
org.testcontainers.couchbase.BucketDefinition

public class BucketDefinition extends Object
Allows to configure the properties of a bucket that should be created.
  • Constructor Details

    • BucketDefinition

      public BucketDefinition(String name)
  • Method Details

    • withReplicas

      public BucketDefinition withReplicas(int numReplicas)
      Allows to configure the number of replicas on a bucket (defaults to 0).

      By default the bucket is initialized with 0 replicas since only a single container is launched. Modifying this value can still be useful in some test scenarios (i.e. to test failures with the wrong number of replicas and durability requirements on operations).

      Couchbase buckets can have a maximum of three replicas configured.

      Parameters:
      numReplicas - the number of replicas to configure.
      Returns:
      this BucketDefinition for chaining purposes.
    • withFlushEnabled

      public BucketDefinition withFlushEnabled(boolean flushEnabled)
      Enables flush for this bucket (disabled by default).
      Parameters:
      flushEnabled - if true, the bucket can be flushed.
      Returns:
      this BucketDefinition for chaining purposes.
    • withQuota

      public BucketDefinition withQuota(int quota)
      Sets a custom bucket quota (100MiB by default).
      Parameters:
      quota - the quota to set for the bucket in mebibytes.
      Returns:
      this BucketDefinition for chaining purposes.
    • withPrimaryIndex

      public BucketDefinition withPrimaryIndex(boolean create)
      Allows to disable creating a primary index for this bucket (enabled by default).
      Parameters:
      create - if false, a primary index will not be created.
      Returns:
      this BucketDefinition for chaining purposes.
    • getName

      public String getName()
    • hasFlushEnabled

      public boolean hasFlushEnabled()
    • hasPrimaryIndex

      public boolean hasPrimaryIndex()
    • getQuota

      public int getQuota()
    • getNumReplicas

      public int getNumReplicas()