LadyForest commented on a change in pull request #20: URL: https://github.com/apache/flink-table-store/pull/20#discussion_r808767370
########## File path: flink-table-store-core/src/main/java/org/apache/flink/table/store/log/LogOptions.java ########## @@ -0,0 +1,192 @@ +/* + * 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.flink.table.store.log; + +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.ConfigOptions; +import org.apache.flink.configuration.DescribedEnum; +import org.apache.flink.configuration.description.Description; +import org.apache.flink.configuration.description.InlineElement; + +import java.time.Duration; + +import static org.apache.flink.configuration.description.TextElement.text; +import static org.apache.flink.table.store.utils.OptionsUtils.formatEnumOption; + +/** Options for log store. */ +public class LogOptions { + + public static final ConfigOption<LogStartupMode> SCAN = + ConfigOptions.key("scan") + .enumType(LogStartupMode.class) + .defaultValue(LogStartupMode.FULL) + .withDescription( + Description.builder() + .text("Specifies the startup mode for log consumer.") + .linebreak() + .list(formatEnumOption(LogStartupMode.FULL)) + .list(formatEnumOption(LogStartupMode.LATEST)) + .list(formatEnumOption(LogStartupMode.FROM_TIMESTAMP)) + .build()); + + public static final ConfigOption<Long> SCAN_TIMESTAMP_MILLS = + ConfigOptions.key("scan.timestamp-millis") + .longType() + .noDefaultValue() + .withDescription( + "Optional timestamp used in case of \"from-timestamp\" scan mode"); + + public static final ConfigOption<Duration> RETENTION = + ConfigOptions.key("retention") + .durationType() + .noDefaultValue() + .withDescription( + "It means how long changes log will be kept. The default value is from the log system cluster."); + + public static final ConfigOption<LogConsistency> CONSISTENCY = + ConfigOptions.key("consistency") + .enumType(LogConsistency.class) + .defaultValue(LogConsistency.TRANSACTIONAL) + .withDescription( + Description.builder() + .text("Specifies the log consistency mode for table.") + .linebreak() + .list( + formatEnumOption(LogConsistency.TRANSACTIONAL), + formatEnumOption(LogConsistency.EVENTUAL)) + .build()); + + public static final ConfigOption<LogChangelogMode> CHANGELOG_MODE = + ConfigOptions.key("changelog-mode") + .enumType(LogChangelogMode.class) + .defaultValue(LogChangelogMode.AUTO) + .withDescription( + Description.builder() + .text("Specifies the log changelog mode for table.") + .linebreak() + .list( + formatEnumOption(LogChangelogMode.AUTO), + formatEnumOption(LogChangelogMode.ALL), + formatEnumOption(LogChangelogMode.UPSERT)) + .build()); + + public static final ConfigOption<String> KEY_FORMAT = + ConfigOptions.key("key.format") + .stringType() + .defaultValue("json") + .withDescription( + "Specifies the key message format of log system with primary key."); + + public static final ConfigOption<String> FORMAT = + ConfigOptions.key("format") + .stringType() + .defaultValue("debezium-json") + .withDescription("Specifies the message format of log system."); + + /** Specifies the startup mode for log consumer. */ + public enum LogStartupMode implements DescribedEnum { + FULL( + "full", + "Performs a snapshot on the table upon first startup," Review comment: Nit: it seems like the descriptions are all started as third-person singular pronouns for `LATEST` and `FROM_TIMESTAMP`. We'd better keep consistency on this. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
