tech.ydb.topic.settings.AlterTopicSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-sdk-topic Show documentation
Show all versions of ydb-sdk-topic Show documentation
Topic client implementation
The newest version!
package tech.ydb.topic.settings;
import java.time.Duration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import tech.ydb.core.settings.OperationSettings;
import tech.ydb.topic.description.Consumer;
import tech.ydb.topic.description.MeteringMode;
import tech.ydb.topic.description.SupportedCodecs;
/**
* @author Nikolay Perfilov
*/
public class AlterTopicSettings extends OperationSettings {
@Nullable
private final AlterPartitioningSettings alterPartitioningSettings;
@Nullable
private final Duration retentionPeriod;
@Nullable
private final Long retentionStorageMb;
@Nullable
private final SupportedCodecs supportedCodecs;
@Nullable
private final Long partitionWriteSpeedBytesPerSecond;
@Nullable
private final Long partitionWriteBurstBytes;
private final Map alterAttributes;
private final List addConsumers;
private final List dropConsumers;
private final List alterConsumers;
@Nullable
private final MeteringMode meteringMode;
private AlterTopicSettings(Builder builder) {
super(builder);
this.alterPartitioningSettings = builder.alterPartitioningSettings;
this.retentionPeriod = builder.retentionPeriod;
this.retentionStorageMb = builder.retentionStorageMb;
this.supportedCodecs = builder.supportedCodecs;
this.partitionWriteSpeedBytesPerSecond = builder.partitionWriteSpeedBytesPerSecond;
this.partitionWriteBurstBytes = builder.partitionWriteBurstBytes;
this.alterAttributes = ImmutableMap.copyOf(builder.alterAttributes);
this.addConsumers = ImmutableList.copyOf(builder.addConsumers);
this.dropConsumers = ImmutableList.copyOf(builder.dropConsumers);
this.alterConsumers = ImmutableList.copyOf(builder.alterConsumers);
this.meteringMode = builder.meteringMode;
}
public static Builder newBuilder() {
return new Builder();
}
@Nullable
public AlterPartitioningSettings getAlterPartitioningSettings() {
return alterPartitioningSettings;
}
@Nullable
public Duration getRetentionPeriod() {
return retentionPeriod;
}
@Nullable
public Long getRetentionStorageMb() {
return retentionStorageMb;
}
@Nullable
public SupportedCodecs getSupportedCodecs() {
return supportedCodecs;
}
@Nullable
public Long getPartitionWriteSpeedBytesPerSecond() {
return partitionWriteSpeedBytesPerSecond;
}
@Nullable
public Long getPartitionWriteBurstBytes() {
return partitionWriteBurstBytes;
}
public Map getAlterAttributes() {
return alterAttributes;
}
public List getAddConsumers() {
return addConsumers;
}
public List getDropConsumers() {
return dropConsumers;
}
public List getAlterConsumers() {
return alterConsumers;
}
@Nullable
public MeteringMode getMeteringMode() {
return meteringMode;
}
/**
* BUILDER
*/
public static class Builder extends OperationBuilder {
private AlterPartitioningSettings alterPartitioningSettings = null;
private Duration retentionPeriod = null;
private Long retentionStorageMb = null;
private SupportedCodecs supportedCodecs = null;
private Long partitionWriteSpeedBytesPerSecond = null;
private Long partitionWriteBurstBytes = null;
private Map alterAttributes = new HashMap<>();
private List addConsumers = new ArrayList<>();
private List dropConsumers = new ArrayList<>();
private List alterConsumers = new ArrayList<>();
private MeteringMode meteringMode = null;
public Builder setAlterPartitioningSettings(AlterPartitioningSettings alterPartitioningSettings) {
this.alterPartitioningSettings = alterPartitioningSettings;
return this;
}
public Builder setRetentionPeriod(Duration retentionPeriod) {
this.retentionPeriod = retentionPeriod;
return this;
}
public Builder setRetentionStorageMb(long retentionStorageMb) {
this.retentionStorageMb = retentionStorageMb;
return this;
}
public Builder setSupportedCodecs(SupportedCodecs supportedCodecs) {
this.supportedCodecs = supportedCodecs;
return this;
}
public Builder setPartitionWriteSpeedBytesPerSecond(long partitionWriteSpeedBytesPerSecond) {
this.partitionWriteSpeedBytesPerSecond = partitionWriteSpeedBytesPerSecond;
return this;
}
public Builder setPartitionWriteBurstBytes(long partitionWriteBurstBytes) {
this.partitionWriteBurstBytes = partitionWriteBurstBytes;
return this;
}
public Builder addAlterAttribute(@Nonnull String name, @Nullable String value) {
alterAttributes.put(name, value);
return this;
}
public Builder setAlterAttributes(Map attributes) {
this.alterAttributes = attributes;
return this;
}
public Builder addAddConsumer(Consumer consumer) {
addConsumers.add(consumer);
return this;
}
public Builder setAddConsumers(List consumers) {
addConsumers = consumers;
return this;
}
public Builder addDropConsumer(@Nonnull String consumerName) {
dropConsumers.add(consumerName);
return this;
}
public Builder setDropConsumers(List consumerNames) {
dropConsumers = consumerNames;
return this;
}
public Builder addAlterConsumer(AlterConsumerSettings consumer) {
alterConsumers.add(consumer);
return this;
}
public Builder setAlterConsumers(List consumers) {
alterConsumers = consumers;
return this;
}
public Builder setMeteringMode(MeteringMode meteringMode) {
this.meteringMode = meteringMode;
return this;
}
@Override
public AlterTopicSettings build() {
return new AlterTopicSettings(this);
}
}
}