Class KeyValueConfigBuilder
-
- All Implemented Interfaces:
public final class KeyValueConfigBuilderBuilder for Key-Value store configuration
-
-
Field Summary
Fields Modifier and Type Field Description private Stringdescriptionprivate LongmaxHistoryPerKeyprivate IntegermaxValueSizeprivate LongmaxBucketSizeprivate Durationttlprivate StorageTypestorageTypeprivate Integerreplicasprivate Booleancompression
-
Constructor Summary
Constructors Constructor Description KeyValueConfigBuilder()
-
Method Summary
Modifier and Type Method Description final StringgetDescription()Optional description of the bucket final UnitsetDescription(String value)Optional description of the bucket final LonggetMaxHistoryPerKey()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 UnitsetMaxHistoryPerKey(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 IntegergetMaxValueSize()Maximum size in bytes for a single value Default: -1 (server default, typically 1MB) final UnitsetMaxValueSize(Integer value)Maximum size in bytes for a single value Default: -1 (server default, typically 1MB) final LonggetMaxBucketSize()Maximum number of bytes for the entire bucket Default: -1 (unlimited) final UnitsetMaxBucketSize(Long value)Maximum number of bytes for the entire bucket Default: -1 (unlimited) final DurationgetTtl()Time-to-live for entries in the bucket Default: Duration. final UnitsetTtl(Duration value)Time-to-live for entries in the bucket Default: Duration. final StorageTypegetStorageType()Storage type for the bucket Default: FILE for persistenceOptions: io.nats.client.api.StorageType.File: Persistent storage
io.nats.client.api.StorageType.Memory: In-memory only (faster but not durable)
final UnitsetStorageType(StorageType value)Storage type for the bucket Default: FILE for persistenceOptions: io.nats.client.api.StorageType.File: Persistent storage
io.nats.client.api.StorageType.Memory: In-memory only (faster but not durable)
final IntegergetReplicas()Number of replicas for the bucket (cluster mode) Default: 1 (single replica)For high availability, set to 3 or more (odd numbers recommended) final UnitsetReplicas(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 BooleangetCompression()Compression option for the bucket Default: false (no compression) final UnitsetCompression(Boolean value)Compression option for the bucket Default: false (no compression) final Unitplacement(Function1<PlacementBuilder, Unit> block)Configure placement constraintsExample: placement { cluster = "east-cluster" tags = listOf("ssd", "high-memory") }-
-
Method Detail
-
getDescription
final String getDescription()
Optional description of the bucket
-
setDescription
final Unit setDescription(String value)
Optional description of the bucket
-
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
-
getStorageType
final StorageType getStorageType()
Storage type for the bucket Default: FILE for persistence
Options:
io.nats.client.api.StorageType.File: Persistent storage
io.nats.client.api.StorageType.Memory: In-memory only (faster but not durable)
-
setStorageType
final Unit setStorageType(StorageType value)
Storage type for the bucket Default: FILE for persistence
Options:
io.nats.client.api.StorageType.File: Persistent storage
io.nats.client.api.StorageType.Memory: In-memory only (faster but not durable)
-
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()
Compression option for the bucket Default: false (no compression)
-
setCompression
final Unit setCompression(Boolean value)
Compression option for the bucket Default: false (no compression)
-
placement
final Unit placement(Function1<PlacementBuilder, Unit> block)
Configure placement constraints
Example:
placement { cluster = "east-cluster" tags = listOf("ssd", "high-memory") }
-
-
-