yifan-c commented on code in PR #193: URL: https://github.com/apache/cassandra-sidecar/pull/193#discussion_r1974167061
########## server/src/main/java/org/apache/cassandra/sidecar/cdc/CdcConfig.java: ########## @@ -0,0 +1,181 @@ +/* + * 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.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * In memory representation of CDC and Kafka configurations from "configs" table in sidecar keyspace. + */ +public interface CdcConfig +{ + Logger LOGGER = LoggerFactory.getLogger(CdcConfig.class); + + String DEFAULT_JOB_ID = "test-job"; + int DEFAULT_MAX_WATERMARKER_SIZE = 400000; Review Comment: I am aware of its usage. My suggestion is to keep interface as interface, do not return default values from the interface methods. Almost all methods defined in the interface is overridden in the implementation. It further makes the default methods in the interface less meaningful. So, the following is my suggestion for the interface. ```java public interface CdcConfig { /** * Topic format */ enum TopicFormatType { // TODO: add javadoc for each enum STATIC, KEYSPACE, KEYSPACETABLE, TABLE, MAP, } // TODO: add javadoc for this and others String env(); String dc(); @Nullable String kafkaTopic(); @NotNull TopicFormatType topicFormat(); boolean cdcEnabled(); String jobId(); Map<String, Object> kafkaConfigs(); Map<String, Object> cdcConfigs(); boolean logOnly(); MinuteBoundConfiguration watermarkWindow(); /** * @return max Kafka record size in bytes. If value is non-negative then the KafkaPublisher will chunk larger records into multiple messages. */ int maxRecordSizeBytes(); /** * @return "zstd" to enable compression on large blobs, or null or empty string if disabled. */ @Nullable String compression(); /** * @return true if Kafka publisher should fail if Kafka client returns "record too large" error */ boolean failOnRecordTooLargeError(); /** * @return true if Kafka publisher should fail if Kafka client returns any other error. */ boolean failOnKafkaError(); /** * Initialization of tables and loading config takes some time, returns if the config * is ready to be loaded or not. * * @return true if config is ready to be read. */ boolean isConfigReady(); MillisecondBoundConfiguration minDelayBetweenMicroBatches(); int maxCommitLogsPerInstance(); /** * @return the maximum number of entries to hold in the watermarker state for mutations that * are have not achieved the consistency level. Each entry is an MD5 with a byte integer, * approximately 30-60 bytes per entry before compression. */ int maxWatermarkerSize(); /** * @return true if CDC state should be persisted to Cassandra */ boolean persistEnabled(); /** * @return the delay in millis between persist calls. */ MillisecondBoundConfiguration persistDelay(); } ``` And the default values should be defined in `CdcConfigImpl` -- 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