use of com.ms.silverking.cloud.management.MetaToolOptions in project SilverKing by Morgan-Stanley.
the class StaticDHTCreator method createStaticDHT.
public void createStaticDHT(UUIDBase uuid, int initialHeapSize, int maxHeapSize, String skInstanceLogBaseVar, String dataBaseVar, String skfsConfigurationFile) throws IOException, KeeperException {
String ringName;
String classVarsName;
RingCreationResults rcResults;
MetaClient mc;
mc = new MetaClient(dhtName, zkConfig);
// Create Ring
ringName = ringNameBase + uuid.toString();
rcResults = StaticRingCreator.createStaticRing(ringName, zkConfig, servers, replication, uuid);
// Create class vars
ClassVars classVars;
Map<String, String> varsMap;
MetaToolOptions mto;
classVarsName = "classVars." + uuid.toString();
varsMap = new HashMap<>();
varsMap.put(DHTConstants.initialHeapSizeVar, Integer.toString(initialHeapSize));
varsMap.put(DHTConstants.maxHeapSizeVar, Integer.toString(maxHeapSize));
if (skInstanceLogBaseVar != null) {
varsMap.put(DHTConstants.skInstanceLogBaseVar, skInstanceLogBaseVar);
}
if (dataBaseVar != null) {
varsMap.put(DHTConstants.dataBaseVar, dataBaseVar);
}
classVars = new ClassVars(varsMap, VersionedDefinition.NO_VERSION);
new ClassVarsZK(mc).writeToZK(classVars, classVarsName);
// Create DHTConfig
DHTConfiguration dhtConfig;
dhtConfig = new DHTConfiguration(ringName, port, passiveNodes, nsCreationOptions, ImmutableMap.of(rcResults.hostGroupName, classVarsName), 0, Long.MIN_VALUE, null);
new DHTConfigurationZK(mc).writeToZK(dhtConfig, null);
// Write out curRingAndVersion
new DHTRingCurTargetZK(mc, dhtConfig).setCurRingAndVersionPair(ringName, 0, 0);
new DHTRingCurTargetZK(mc, dhtConfig).setTargetRingAndVersionPair(ringName, 0, 0);
// Write skfs configuration if present
if (skfsConfigurationFile != null) {
writeSKFSConfig(gcName, new File(skfsConfigurationFile));
}
// Write GridConfig
Map<String, String> envMap;
envMap = new HashMap<>();
envMap.put(ClientDHTConfiguration.nameVar, dhtName);
envMap.put(ClientDHTConfiguration.portVar, Integer.toString(port));
envMap.put(ClientDHTConfiguration.zkLocVar, zkConfig.getConnectString());
writeGridConfig(new SKGridConfiguration(gcName, envMap), gridConfigDir, gcName);
System.out.println(gcName);
}
use of com.ms.silverking.cloud.management.MetaToolOptions in project SilverKing by Morgan-Stanley.
the class ClassVarsZK method getClassVars.
public ClassVars getClassVars(String classVarsName) throws KeeperException {
MetaToolOptions mto;
mto = new MetaToolOptions();
mto.name = classVarsName;
return readFromZK(-1, mto);
}
Aggregations