dlmarion commented on code in PR #2665: URL: https://github.com/apache/accumulo/pull/2665#discussion_r940254230
########## core/src/main/java/org/apache/accumulo/core/spi/scan/ScanServerSelector.java: ########## @@ -0,0 +1,182 @@ +/* + * 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 + * + * https://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.accumulo.core.spi.scan; + +import java.time.Duration; +import java.util.Collection; +import java.util.Map; +import java.util.function.Supplier; + +import org.apache.accumulo.core.client.ScannerBase; +import org.apache.accumulo.core.data.TabletId; +import org.apache.accumulo.core.spi.common.ServiceEnvironment; + +import com.google.common.base.Preconditions; + +/** + * A client side plugin that determines what scan servers to use for eventually consistent scans. + * When a scanner sets + * {@link org.apache.accumulo.core.client.ScannerBase#setConsistencyLevel(ScannerBase.ConsistencyLevel)} + * to {@link org.apache.accumulo.core.client.ScannerBase.ConsistencyLevel#EVENTUAL} then this plugin + * is used to determine which scan servers to use for a given tablet. To configure a class to use + * for this plugin set its name using the client config {@code scan.server.selector.impl} + * + * @since 2.1.0 + */ +public interface ScanServerSelector { + + /** + * The scan server group name that will be used when one is not specified. + */ + public static final String DEFAULT_SCAN_SERVER_GROUP_NAME = "default"; + + /** + * Information about a scan server. + * + * @since 2.1.0 + */ + public interface ScanServer { + /** + * @return the address in the form of {@code <host>:<port>} where the scan server is running. + */ + String getAddress(); + + /** + * @return the group name set when the scan server was started. If a group name was not set for + * the scan server, then the string {@value #DEFAULT_SCAN_SERVER_GROUP_NAME} is + * returned. + */ + String getGroup(); + } + + /** + * This interface exists so that is easier to evolve what is passed to + * {@link #init(InitParameters)} without having to make breaking changes. + * + * @since 2.1.0 + */ + public interface InitParameters { Review Comment: Created issue #2855 to determine whether moving the interfaces to their own files makes sense. I'm 50-50 on this personally. -- 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]
