use of org.voltdb.compiler.deploymentfile.PathsType in project voltdb by VoltDB.
the class CatalogUtil method updateRuntimeDeploymentPaths.
/**
* Get a deployment view that represents what needs to be displayed to VMC, which
* reflects the paths that are used by this cluster member and the actual number of
* hosts that belong to this cluster whether or not it was elastically expanded
* @param deployment
* @return adjusted deployment
*/
public static DeploymentType updateRuntimeDeploymentPaths(DeploymentType deployment) {
deployment = CatalogUtil.shallowClusterAndPathsClone(deployment);
PathsType paths = deployment.getPaths();
if (paths.getVoltdbroot() == null) {
PathsType.Voltdbroot root = new PathsType.Voltdbroot();
root.setPath(VoltDB.instance().getVoltDBRootPath());
paths.setVoltdbroot(root);
} else {
paths.getVoltdbroot().setPath(VoltDB.instance().getVoltDBRootPath());
}
//snapshot
if (paths.getSnapshots() == null) {
PathsType.Snapshots snap = new PathsType.Snapshots();
snap.setPath(VoltDB.instance().getSnapshotPath());
paths.setSnapshots(snap);
} else {
paths.getSnapshots().setPath(VoltDB.instance().getSnapshotPath());
}
if (paths.getCommandlog() == null) {
//cl
PathsType.Commandlog cl = new PathsType.Commandlog();
cl.setPath(VoltDB.instance().getCommandLogPath());
paths.setCommandlog(cl);
} else {
paths.getCommandlog().setPath(VoltDB.instance().getCommandLogPath());
}
if (paths.getCommandlogsnapshot() == null) {
//cl snap
PathsType.Commandlogsnapshot clsnap = new PathsType.Commandlogsnapshot();
clsnap.setPath(VoltDB.instance().getCommandLogSnapshotPath());
paths.setCommandlogsnapshot(clsnap);
} else {
paths.getCommandlogsnapshot().setPath(VoltDB.instance().getCommandLogSnapshotPath());
}
if (paths.getExportoverflow() == null) {
//export overflow
PathsType.Exportoverflow exp = new PathsType.Exportoverflow();
exp.setPath(VoltDB.instance().getExportOverflowPath());
paths.setExportoverflow(exp);
} else {
paths.getExportoverflow().setPath(VoltDB.instance().getExportOverflowPath());
}
if (paths.getDroverflow() == null) {
//dr overflow
final PathsType.Droverflow droverflow = new PathsType.Droverflow();
droverflow.setPath(VoltDB.instance().getDROverflowPath());
paths.setDroverflow(droverflow);
} else {
paths.getDroverflow().setPath(VoltDB.instance().getDROverflowPath());
}
return deployment;
}
use of org.voltdb.compiler.deploymentfile.PathsType in project voltdb by VoltDB.
the class CatalogUtil method shallowClusterAndPathsClone.
/**
* Creates a shallow clone of {@link DeploymentType} where all its
* children references are copied except for {@link ClusterType}, and
* {@link PathsType} which are newly instantiated
* @param o
* @return a shallow clone of {@link DeploymentType}
*/
public static DeploymentType shallowClusterAndPathsClone(DeploymentType o) {
DeploymentType clone = new DeploymentType();
clone.setPartitionDetection(o.getPartitionDetection());
clone.setHeartbeat(o.getHeartbeat());
clone.setHttpd(o.getHttpd());
clone.setSnapshot(o.getSnapshot());
clone.setExport(o.getExport());
clone.setUsers(o.getUsers());
clone.setCommandlog(o.getCommandlog());
clone.setSystemsettings(o.getSystemsettings());
clone.setSecurity(o.getSecurity());
clone.setDr(o.getDr());
clone.setImport(o.getImport());
clone.setConsistency(o.getConsistency());
ClusterType other = o.getCluster();
ClusterType cluster = new ClusterType();
cluster.setHostcount(other.getHostcount());
cluster.setSitesperhost(other.getSitesperhost());
cluster.setKfactor(other.getKfactor());
cluster.setId(other.getId());
cluster.setElastic(other.getElastic());
cluster.setSchema(other.getSchema());
clone.setCluster(cluster);
PathsType prev = o.getPaths();
PathsType paths = new PathsType();
paths.setVoltdbroot(prev.getVoltdbroot());
paths.setSnapshots(prev.getSnapshots());
paths.setExportoverflow(prev.getExportoverflow());
paths.setDroverflow(prev.getDroverflow());
paths.setCommandlog(prev.getCommandlog());
paths.setCommandlogsnapshot(prev.getCommandlogsnapshot());
clone.setPaths(paths);
clone.setSsl(o.getSsl());
clone.setSnmp(o.getSnmp());
return clone;
}
Aggregations