ChenSammi commented on code in PR #7379: URL: https://github.com/apache/ozone/pull/7379#discussion_r1827203219
########## hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/DomainSocketFactory.java: ########## @@ -0,0 +1,272 @@ +/** + * 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.hadoop.hdds.scm.storage; + +import com.google.common.annotations.VisibleForTesting; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.SystemUtils; +import org.apache.hadoop.hdds.conf.ConfigurationSource; +import org.apache.hadoop.hdds.scm.OzoneClientConfig; +import org.apache.hadoop.net.unix.DomainSocket; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Closeable; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ConcurrentHashMap; + +/** + * A factory to help create DomainSocket. + */ +public final class DomainSocketFactory implements Closeable { + private static final Logger LOG = LoggerFactory.getLogger( + DomainSocketFactory.class); + + /** + * Domain socket path state. + */ + public enum PathState { + NOT_CONFIGURED(false), + DISABLED(false), + VALID(true); + + PathState(boolean usableForShortCircuit) { + this.usableForShortCircuit = usableForShortCircuit; + } + + public boolean getUsableForShortCircuit() { + return usableForShortCircuit; + } + private final boolean usableForShortCircuit; + } + + /** + * Domain socket path. + */ + public static class PathInfo { + private static final PathInfo NOT_CONFIGURED = new PathInfo("", PathState.NOT_CONFIGURED); + private static final PathInfo DISABLED = new PathInfo("", PathState.DISABLED); + private static final PathInfo VALID = new PathInfo("", PathState.VALID); + + private final String path; + private final PathState state; + + PathInfo(String path, PathState state) { + this.path = path; + this.state = state; + } + + public String getPath() { + return path; + } + + public PathState getPathState() { + return state; + } + + @Override + public String toString() { + return "PathInfo{path=" + path + ", state=" + state + "}"; + } + } + + public static final String FEATURE = "short-circuit reads"; + public static final String FEATURE_FLAG = "SC"; Review Comment: It will be used in next patch. -- 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]
