Jackie-Jiang commented on code in PR #17431: URL: https://github.com/apache/pinot/pull/17431#discussion_r2677936384
########## pinot-common/src/main/java/org/apache/pinot/common/tier/TierSegmentSelectorRegistry.java: ########## @@ -0,0 +1,91 @@ +/** + * 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.pinot.common.tier; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.pinot.spi.config.table.TierConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Registry for tier segment selector factories. + * Plugins can register custom selector factories using the {@link TierSegmentSelectorFactory} interface. + */ +public final class TierSegmentSelectorRegistry { + private TierSegmentSelectorRegistry() { + } + + private static final Logger LOGGER = LoggerFactory.getLogger(TierSegmentSelectorRegistry.class); + + /** + * Functional interface for creating TierSegmentSelector instances. + */ + @FunctionalInterface + public interface TierSegmentSelectorFactory { + /** + * Creates a TierSegmentSelector from the given TierConfig. + */ + TierSegmentSelector create(TierConfig tierConfig); + } + + private static final ConcurrentHashMap<String, TierSegmentSelectorFactory> FACTORIES = new ConcurrentHashMap<>(); Review Comment: We don't need a current map here. All the registration should happen during component startup ########## pinot-common/src/main/java/org/apache/pinot/common/tier/TimeBasedTierSegmentSelector.java: ########## @@ -28,6 +29,13 @@ */ public class TimeBasedTierSegmentSelector implements TierSegmentSelector { private final long _segmentAgeMillis; + /** + * Static factory method to create a TimeBasedTierSegmentSelector from TierConfig + */ + public static TimeBasedTierSegmentSelector create(TierConfig tierConfig) { Review Comment: Is this change required? -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
