Class KeyValueConfigBuilder

  • All Implemented Interfaces:

    
    public final class KeyValueConfigBuilder
    
                        

    Builder for Key-Value store configuration

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getDescription() Optional description of the bucket
      final Unit setDescription(String value) Optional description of the bucket
      final Long getMaxHistoryPerKey() Maximum number of history entries per key (includes current value) Default: 1 (only keep current value) Set to higher value to track history of changes
      final Unit setMaxHistoryPerKey(Long value) Maximum number of history entries per key (includes current value) Default: 1 (only keep current value) Set to higher value to track history of changes
      final Integer getMaxValueSize() Maximum size in bytes for a single value Default: -1 (server default, typically 1MB)
      final Unit setMaxValueSize(Integer value) Maximum size in bytes for a single value Default: -1 (server default, typically 1MB)
      final Long getMaxBucketSize() Maximum number of bytes for the entire bucket Default: -1 (unlimited)
      final Unit setMaxBucketSize(Long value) Maximum number of bytes for the entire bucket Default: -1 (unlimited)
      final Duration getTtl() Time-to-live for entries in the bucket Default: Duration.
      final Unit setTtl(Duration value) Time-to-live for entries in the bucket Default: Duration.
      final StorageType getStorageType() Storage type for the bucket Default: StorageType.FILE for persistence
      final Unit setStorageType(StorageType value) Storage type for the bucket Default: StorageType.FILE for persistence
      final Integer getReplicas() Number of replicas for the bucket (cluster mode) Default: 1 (single replica)For high availability, set to 3 or more (odd numbers recommended)
      final Unit setReplicas(Integer value) Number of replicas for the bucket (cluster mode) Default: 1 (single replica)For high availability, set to 3 or more (odd numbers recommended)
      final Boolean getCompression() Whether the bucket's messages are stored S2-compressed Default: false (no compression)Only read when the bucket is created: natsy leaves an existing bucket's configuration alone.
      final Unit setCompression(Boolean value) Whether the bucket's messages are stored S2-compressed Default: false (no compression)Only read when the bucket is created: natsy leaves an existing bucket's configuration alone.
      final Unit placement(Function1<PlacementBuilder, Unit> block) Configure placement constraintsExample:
      placement {
          cluster = "east-cluster"
          tags = listOf("ssd", "high-memory")
      }
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KeyValueConfigBuilder

        KeyValueConfigBuilder()
    • Method Detail

      • getMaxHistoryPerKey

         final Long getMaxHistoryPerKey()

        Maximum number of history entries per key (includes current value) Default: 1 (only keep current value) Set to higher value to track history of changes

      • setMaxHistoryPerKey

         final Unit setMaxHistoryPerKey(Long value)

        Maximum number of history entries per key (includes current value) Default: 1 (only keep current value) Set to higher value to track history of changes

      • getMaxValueSize

         final Integer getMaxValueSize()

        Maximum size in bytes for a single value Default: -1 (server default, typically 1MB)

      • setMaxValueSize

         final Unit setMaxValueSize(Integer value)

        Maximum size in bytes for a single value Default: -1 (server default, typically 1MB)

      • getMaxBucketSize

         final Long getMaxBucketSize()

        Maximum number of bytes for the entire bucket Default: -1 (unlimited)

      • setMaxBucketSize

         final Unit setMaxBucketSize(Long value)

        Maximum number of bytes for the entire bucket Default: -1 (unlimited)

      • getTtl

         final Duration getTtl()

        Time-to-live for entries in the bucket Default: Duration.ZERO (no expiration)

        Example: ttl = 24.hours

      • setTtl

         final Unit setTtl(Duration value)

        Time-to-live for entries in the bucket Default: Duration.ZERO (no expiration)

        Example: ttl = 24.hours

      • getReplicas

         final Integer getReplicas()

        Number of replicas for the bucket (cluster mode) Default: 1 (single replica)

        For high availability, set to 3 or more (odd numbers recommended)

      • setReplicas

         final Unit setReplicas(Integer value)

        Number of replicas for the bucket (cluster mode) Default: 1 (single replica)

        For high availability, set to 3 or more (odd numbers recommended)

      • getCompression

         final Boolean getCompression()

        Whether the bucket's messages are stored S2-compressed Default: false (no compression)

        Only read when the bucket is created: natsy leaves an existing bucket's configuration alone.

      • setCompression

         final Unit setCompression(Boolean value)

        Whether the bucket's messages are stored S2-compressed Default: false (no compression)

        Only read when the bucket is created: natsy leaves an existing bucket's configuration alone.

      • placement

         final Unit placement(Function1<PlacementBuilder, Unit> block)

        Configure placement constraints

        Example:

        placement {
            cluster = "east-cluster"
            tags = listOf("ssd", "high-memory")
        }