dcapwell commented on a change in pull request #1: Introduce the extracted in-JVM DTest API URL: https://github.com/apache/cassandra-in-jvm-dtest-api/pull/1#discussion_r384689479
########## File path: src/main/java/org/apache/cassandra/distributed/shared/NetworkTopology.java ########## @@ -0,0 +1,216 @@ +/* + * 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.distributed.shared; + +import java.io.Serializable; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.IntFunction; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public class NetworkTopology +{ + private final Map<AddressAndPort, DcAndRack> map; + + public static class DcAndRack + { + private final String dc; + private final String rack; + + private DcAndRack(String dc, String rack) + { + this.dc = dc; + this.rack = rack; + } + + @Override + public String toString() + { + return "DcAndRack{" + + "dc='" + dc + '\'' + + ", rack='" + rack + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DcAndRack dcAndRack = (DcAndRack) o; + return Objects.equals(dc, dcAndRack.dc) && + Objects.equals(rack, dcAndRack.rack); + } + + @Override + public int hashCode() + { + return Objects.hash(dc, rack); + } + } + + public static class AddressAndPort implements Serializable Review comment: I feel this should be top level ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org For additional commands, e-mail: dev-h...@cassandra.apache.org