io.quarkiverse.reactive.messaging.nats.jetstream.client.configuration.KeyValueSetupConfiguration Maven / Gradle / Ivy
package io.quarkiverse.reactive.messaging.nats.jetstream.client.configuration;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import io.nats.client.api.StorageType;
import io.quarkiverse.reactive.messaging.nats.jetstream.JetStreamBuildConfiguration;
public interface KeyValueSetupConfiguration {
/**
* Bucket Name of Key-Value store
*/
String bucketName();
/**
* Description of Key-Value store
*/
Optional description();
/**
* The storage type (File or Memory).
*/
StorageType storageType();
/**
* The maximum number of bytes for this bucket
*/
Optional maxBucketSize();
/**
* The maximum number of history for any one key. Includes the current value.
*/
Optional maxHistoryPerKey();
/**
* The maximum size for an individual value in the bucket.
*/
Optional maxValueSize();
/**
* The maximum age for a value in this bucket
*/
Optional ttl();
/**
* The number of replicas for this bucket
*/
Optional replicas();
/**
* Sets whether to use compression
*/
Boolean compressed();
static List of(JetStreamBuildConfiguration configuration) {
return configuration.keyValueStores().stream()
.map(store -> (KeyValueSetupConfiguration) DefaultKeyValueSetupConfiguration.builder()
.bucketName(store.bucketName())
.description(store.description())
.storageType(store.storageType())
.maxBucketSize(store.maxBucketSize())
.maxHistoryPerKey(store.maxHistoryPerKey())
.maxValueSize(store.maxValueSize())
.ttl(store.ttl().map(Duration::parse))
.replicas(store.replicas())
.compressed(store.compressed())
.build())
.toList();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy