cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] codacy-bot commented on a change in pull request #354: CASSANDRA-15319 against 2.2
Date Sun, 06 Oct 2019 19:17:16 GMT
codacy-bot commented on a change in pull request #354: CASSANDRA-15319 against 2.2
URL: https://github.com/apache/cassandra/pull/354#discussion_r331805588
 
 

 ##########
 File path: test/distributed/org/apache/cassandra/distributed/impl/DistributedTestSnitch.java
 ##########
 @@ -0,0 +1,61 @@
+/*
+ * 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.impl;
+
+import java.net.InetAddress;
+
+import org.apache.cassandra.config.Config;
+import org.apache.cassandra.locator.AbstractNetworkTopologySnitch;
+import org.apache.cassandra.locator.InetAddressAndPort;
+
+public class DistributedTestSnitch extends AbstractNetworkTopologySnitch
+{
+    private static NetworkTopology mapping = null;
+
+    public String getRack(InetAddress endpoint)
+    {
+        assert mapping != null : "network topology must be assigned before using snitch";
+        int storage_port = Config.getOverrideLoadConfig().get().storage_port;
+        return mapping.localRack(InetAddressAndPort.getByAddressOverrideDefaults(endpoint,
storage_port));
+    }
+
+    public String getRack(InetAddressAndPort endpoint)
+    {
+        assert mapping != null : "network topology must be assigned before using snitch";
+        return mapping.localRack(endpoint);
+    }
+
+    public String getDatacenter(InetAddress endpoint)
+    {
+        assert mapping != null : "network topology must be assigned before using snitch";
+        int storage_port = Config.getOverrideLoadConfig().get().storage_port;
+        return mapping.localDC(InetAddressAndPort.getByAddressOverrideDefaults(endpoint,
storage_port));
+    }
+
+    public String getDatacenter(InetAddressAndPort endpoint)
+    {
+        assert mapping != null : "network topology must be assigned before using snitch";
+        return mapping.localDC(endpoint);
+    }
+
+    static void assign(NetworkTopology newMapping)
 
 Review comment:
   ![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Use explicit
scoping instead of the default package private level](https://app.codacy.com/app/Wen1234/cassandra/pullRequest?prid=4274605)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message