Class BucketSettings

    • Constructor Detail

      • BucketSettings

        @Internal
        public BucketSettings​(String name,
                              Map<String,​String> controllers,
                              Map<String,​Long> quota,
                              int numReplicas,
                              boolean replicaIndex,
                              int maxTTL,
                              CompressionMode compressionMode,
                              BucketType bucketType,
                              ConflictResolutionType conflictResolutionType,
                              EvictionPolicyType evictionPolicy,
                              String durabilityMinLevel,
                              StorageBackend storageBackend)
        Creates BucketSettings from a raw JSON payload.

        Do not use this API directly, it's internal! Instead use BucketSettings(String) and then apply the customizations through its setters.

        Parameters:
        name - the name of the bucket.
        controllers - the configured controllers.
        quota - the current bucket quota.
        numReplicas - the number of replicas configured.
        replicaIndex - the replica index.
        maxTTL - the maximum TTL currently configured.
        compressionMode - which compression mode is used, if any.
        bucketType - which bucket type is used.
        conflictResolutionType - which conflict resolution type is currently in use.
        evictionPolicy - the eviction policy in use.
        durabilityMinLevel - the minimum durability level configured, if any.
        storageBackend - the storage backend in use.
    • Method Detail

      • name

        public String 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

        public DurabilityLevel 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

        public Duration maxExpiry()
        Returns the maximum expiry (time-to-live) for all documents in the bucket.
      • bucketType

        public BucketType bucketType()
        Returns the bucket type.
      • conflictResolutionType

        public ConflictResolutionType conflictResolutionType()
        Returns the conflict resolution mode in use.
      • evictionPolicy

        public EvictionPolicyType evictionPolicy()
        Returns the eviction policy used on the bucket.
      • healthy

        @Internal
        public boolean healthy()
        Returns true if the bucket is identified as healthy by the cluster manager.
      • flushEnabled

        public BucketSettings flushEnabled​(boolean 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

        public BucketSettings ramQuotaMB​(long 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

        public BucketSettings numReplicas​(int numReplicas)
        Sets the number of replica copies for the bucket.
        Parameters:
        numReplicas - the number of replicas.
        Returns:
        this BucketSettings instance for chaining purposes.
      • replicaIndexes

        public BucketSettings replicaIndexes​(boolean 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

        public BucketSettings maxExpiry​(Duration 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

        public BucketSettings compressionMode​(CompressionMode compressionMode)
        Sets the compression mode on the bucket.
        Parameters:
        compressionMode - the compression mode to use.
        Returns:
        this BucketSettings instance for chaining purposes.
      • conflictResolutionType

        public BucketSettings conflictResolutionType​(ConflictResolutionType 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

        public BucketSettings evictionPolicy​(EvictionPolicyType evictionPolicy)
        Allows to configure a custom 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.

        Parameters:
        evictionPolicy - (nullable) policy to use, or null for default policy for the BucketType.
        Returns:
        this BucketSettings instance for chaining purposes.
      • maxTTL

        @Deprecated
        public int maxTTL()
        Deprecated.
        please use maxExpiry() instead.
        Returns the maximum expiry (time-to-live) for all documents in the bucket in seconds.
      • maxTTL

        @Deprecated
        public BucketSettings maxTTL​(int maxTTL)
        Deprecated.
        please use maxExpiry(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.