本文整理了Java中com.spotify.helios.servicescommon.coordination.ZooKeeperOperations
类的一些代码示例,展示了ZooKeeperOperations
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperOperations
类的具体详情如下:
包路径:com.spotify.helios.servicescommon.coordination.ZooKeeperOperations
类名称:ZooKeeperOperations
暂无
代码示例来源:origin: spotify/helios
operations.add(check(Paths.configHost(host)));
operations.add(delete(node));
operations.add(create(Paths.statusHost(host)));
operations.add(create(Paths.statusHostJobs(host)));
operations.add(delete(Paths.configHostId(host)));
operations.add(create(Paths.configHostId(host), hostId.getBytes(UTF_8)));
代码示例来源:origin: spotify/helios
operations.add(set(statusPath, status));
operations.add(delete(tasksPath));
} else {
operations.add(create(tasksPath));
operations.add(delete(tasksPath));
代码示例来源:origin: spotify/helios
final UUID jobCreationOperationId = getJobCreation(client, id);
if (jobCreationOperationId != null) {
operations.add(delete(Paths.configJobCreation(id, jobCreationOperationId)));
operations.add(delete(Paths.configJobHosts(id)),
delete(Paths.configJobRefShort(id)),
delete(Paths.configJob(id)),
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
client.transaction(operations.build());
} catch (final NoNodeException e) {
代码示例来源:origin: spotify/helios
try {
client.ensurePath(Paths.historyJob(id));
client.transaction(create(Paths.configJob(id), job),
create(Paths.configJobRefShort(id), id),
create(Paths.configJobHosts(id)),
create(creationPath),
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
} catch (final NodeExistsException e) {
if (client.exists(creationPath) != null) {
代码示例来源:origin: spotify/helios
deployment.getDeployerMaster(), deployment.getDeploymentGroupName());
final List<ZooKeeperOperation> operations = Lists.newArrayList(
check(jobPath),
create(portNodes),
create(Paths.configJobHost(id, host)));
checkForPortConflicts(client, host, port, id);
operations.add(create(taskPath, task));
operations.add(create(taskCreationPath));
} catch (KeeperException e) {
throw new HeliosRuntimeException("reading existing task description failed", e);
代码示例来源:origin: spotify/helios
ops.add(set(Paths.statusDeploymentGroupHosts(groupName), Json.asBytes(hosts)));
ops.add(set(Paths.statusDeploymentGroupRemovedHosts(groupName), Json.asBytes(removedHosts)));
ops.add(check(Paths.configDeploymentGroup(groupName), deploymentGroupVersion));
ops.add(set(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup));
代码示例来源:origin: spotify/helios
public static ZooKeeperOperation create(final String path, final Descriptor data,
final int version) {
return create(path, data.toJsonBytes(), version);
}
代码示例来源:origin: spotify/helios
operations.add(delete(node));
operations.add(delete(Paths.configJobHost(job, host)));
operations.add(delete(s));
operations.add(delete(Paths.configHostJobs(host)));
operations.add(delete(node));
operations.add(delete(Paths.configHostPort(host, Integer.valueOf(port))));
operations.add(delete(Paths.configHostPorts(host)));
operations.add(delete(idPath));
operations.add(delete(Paths.configHost(host)));
代码示例来源:origin: spotify/helios
operations.add(create(path));
operations.add(delete(path));
代码示例来源:origin: spotify/helios
final ZooKeeperClient client = provider.get("rollingUpdate");
operations.add(set(Paths.configDeploymentGroup(updated.getName()), updated));
代码示例来源:origin: spotify/helios
ops.add(check(Paths.statusDeploymentGroupTasks(deploymentGroupName),
versionedTasks.version()));
ops.addAll(op.operations());
代码示例来源:origin: spotify/helios
public RollingUpdateOp nextTask(final List<ZooKeeperOperation> operations) {
final List<ZooKeeperOperation> ops = Lists.newArrayList(operations);
final List<Map<String, Object>> events = Lists.newArrayList();
final RolloutTask task = tasks.getRolloutTasks().get(tasks.getTaskIndex());
// Update the task index, delete tasks if done
if (tasks.getTaskIndex() + 1 == tasks.getRolloutTasks().size()) {
final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder()
.setState(DONE)
.build();
// We are done -> delete tasks & update status
ops.add(delete(Paths.statusDeploymentGroupTasks(deploymentGroup.getName())));
ops.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()),
status));
// Emit an event signalling that we're DONE!
events.add(eventFactory.rollingUpdateDone(deploymentGroup));
} else {
ops.add(
set(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()), tasks.toBuilder()
.setTaskIndex(tasks.getTaskIndex() + 1)
.build()));
// Only emit an event if the task resulted in taking in action. If there are no ZK operations
// the task was effectively a no-op.
if (!operations.isEmpty()) {
events.add(eventFactory.rollingUpdateTaskSucceeded(deploymentGroup, task));
}
}
return new RollingUpdateOp(ImmutableList.copyOf(ops), ImmutableList.copyOf(events));
}
代码示例来源:origin: spotify/helios
deployment.getDeployerMaster(), deployment.getDeploymentGroupName());
final List<ZooKeeperOperation> operations = Lists.newArrayList(
check(jobPath),
create(portNodes),
create(Paths.configJobHost(id, host)));
operations.add(create(taskPath, task));
operations.add(create(taskCreationPath));
} catch (KeeperException e) {
throw new HeliosRuntimeException("reading existing task description failed", e);
代码示例来源:origin: spotify/helios
check(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()), version),
set(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()),
Json.asBytes(hostsToUndeploy))));
} catch (KeeperException | IOException e) {
代码示例来源:origin: at.molindo/helios-services
try {
client.ensurePath(Paths.historyJob(id));
client.transaction(create(Paths.configJob(id), job),
create(Paths.configJobRefShort(id), id),
create(Paths.configJobHosts(id)),
create(creationPath),
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
} catch (final NodeExistsException e) {
if (client.exists(creationPath) != null) {
代码示例来源:origin: spotify/helios
public static ZooKeeperOperation create(final String path, final Descriptor data) {
return create(path, data.toJsonBytes());
}
代码示例来源:origin: spotify/helios
return ImmutableList.of(delete(nodes));
代码示例来源:origin: at.molindo/helios-services
@Override
public void stopDeploymentGroup(final String deploymentGroupName)
throws DeploymentGroupDoesNotExistException {
checkNotNull(deploymentGroupName, "name");
log.info("stop deployment-group: name={}", deploymentGroupName);
final ZooKeeperClient client = provider.get("stopDeploymentGroup");
final DeploymentGroup deploymentGroup = getDeploymentGroup(deploymentGroupName);
final String statusPath = Paths.statusDeploymentGroup(deploymentGroupName);
final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder()
.setDeploymentGroup(deploymentGroup)
.setState(FAILED)
.setError("Stopped by user")
.build();
try {
client.ensurePath(statusPath);
client.transaction(set(statusPath, status));
} catch (final NoNodeException e) {
throw new DeploymentGroupDoesNotExistException(deploymentGroupName);
} catch (final KeeperException e) {
throw new HeliosRuntimeException(
"stop deployment-group " + deploymentGroupName + " failed", e);
}
}
代码示例来源:origin: spotify/helios
ops.add(create(Paths.statusDeploymentGroupTasks(deploymentGroup.getName())));
.setState(DONE)
.build();
ops.add(delete(Paths.statusDeploymentGroupTasks(deploymentGroup.getName())));
events.add(eventFactory.rollingUpdateDone(deploymentGroup));
} else {
.setState(ROLLING_OUT)
.build();
ops.add(set(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()), tasks));
ops.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()), status));
代码示例来源:origin: spotify/helios
operations.add(delete(Paths.statusDeploymentGroupTasks(deploymentGroup.getName())));
operations.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()), status));
内容来源于网络,如有侵权,请联系作者删除!