use of org.apache.cassandra.distributed.shared.NetworkTopology in project cassandra by apache.
the class AbstractCluster method buildNetworkTopology.
public static NetworkTopology buildNetworkTopology(INodeProvisionStrategy provisionStrategy, Map<Integer, NetworkTopology.DcAndRack> nodeIdTopology) {
NetworkTopology topology = NetworkTopology.build("", 0, Collections.emptyMap());
IntStream.rangeClosed(1, nodeIdTopology.size()).forEach(nodeId -> {
InetSocketAddress addressAndPort = addressAndPort(provisionStrategy.ipAddress(nodeId), provisionStrategy.storagePort(nodeId));
NetworkTopology.DcAndRack dcAndRack = nodeIdTopology.get(nodeId);
topology.put(addressAndPort, dcAndRack);
});
return topology;
}
use of org.apache.cassandra.distributed.shared.NetworkTopology in project cassandra by apache.
the class AbstractCluster method createInstanceConfig.
private InstanceConfig createInstanceConfig(int nodeNum) {
INodeProvisionStrategy provisionStrategy = nodeProvisionStrategy.create(subnet);
long token = tokenSupplier.token(nodeNum);
NetworkTopology topology = buildNetworkTopology(provisionStrategy, nodeIdTopology);
InstanceConfig config = InstanceConfig.generate(nodeNum, provisionStrategy, topology, root, Long.toString(token), datadirCount);
config.set(Constants.KEY_DTEST_API_CLUSTER_ID, clusterId.toString());
if (configUpdater != null)
configUpdater.accept(config);
return config;
}
Aggregations