jyothsnakonisa commented on code in PR #193: URL: https://github.com/apache/cassandra-sidecar/pull/193#discussion_r1974493133
########## server/src/main/java/org/apache/cassandra/sidecar/cdc/CdcConfigImpl.java: ########## @@ -0,0 +1,337 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.sidecar.cdc; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.function.Supplier; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.ImmutableMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.google.inject.Inject; +import com.google.inject.Singleton; +import io.vertx.core.Promise; + +import org.apache.cassandra.sidecar.common.server.utils.DurationSpec; +import org.apache.cassandra.sidecar.config.CdcConfiguration; +import org.apache.cassandra.sidecar.config.SchemaKeyspaceConfiguration; +import org.apache.cassandra.sidecar.db.CdcConfigAccessor; +import org.apache.cassandra.sidecar.db.KafkaConfigAccessor; +import org.apache.cassandra.sidecar.tasks.PeriodicTask; +import org.apache.cassandra.sidecar.tasks.PeriodicTaskExecutor; +import org.apache.cassandra.sidecar.tasks.ScheduleDecision; +import org.jetbrains.annotations.NotNull; + +/** + * Implementation of the interface {@link CdcConfig}, an in-memory representation holding + * CDC and Kafka configurations from "configs" table inside sidecar internal keyspace. + */ +@Singleton +public class CdcConfigImpl implements CdcConfig +{ + private static final Logger LOGGER = LoggerFactory.getLogger(CdcConfigImpl.class); + private static final String CDC_CONFIG_DC_KEY = "dc"; + private static final String CDC_CONFIG_LOG_ONLY_KEY = "log_only"; + private static final String CDC_CONFIG_PERSIST_STATE_KEY = "persist_state"; + private static final String CDC_CONFIG_ENV_KEY = "env"; + private static final String KAFKA_CONFIG_TOPIC_KEY = "topic"; + private static final String KAFKA_FORMAT_TYPE_CONFIG_TOPIC_KEY = "topic_format_type"; + private static final String CDC_ENABLED_KEY = "cdc_enabled"; + private static final String KAFKA_CONFIG_JOB_ID_KEY = "jobId"; + private static final String WATERMARK_WINDOW_KEY = "watermark_seconds"; + private static final String MICROBATCH_DELAY_KEY = "microbatch_delay_millis"; + private static final String CDC_CONFIG_MAX_COMMIT_LOGS_KEY = "max_commit_logs"; + private static final String CDC_MAX_WATERMARKER_SIZE_KEY = "max_watermarker_size"; + private static final String CDC_FAIL_KAFKA_ERRORS = "fail_kafka_errors"; + private static final String CDC_FAIL_KAFKA_TOO_LARGE_ERRORS = "fail_kafka_too_large_errors"; + private static final String CDC_PERSIST_DELAY_MILLIS = "persist_delay_millis"; Review Comment: Moved all constants to enum -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org