public PipelineModel(PipelineModel other, boolean copyInstances) { this(other.pipelineName, other.canForce, other.canOperate, other.pipelinePauseInfo); this.canAdminister = other.canAdminister; if (copyInstances) { this.activePipelineInstances.addAll(other.activePipelineInstances); } }
private void syncHistoryForDashboard(PipelineInstanceModels pipelineHistoryForDashboard, final CaseInsensitiveString pipelineName) { clearEntryFor(pipelineName); historyForDashboard.addAll(pipelineHistoryForDashboard); lastKnownPipelineNames.add(pipelineName); }
public List<GoDashboardPipeline> allPipelines(CruiseConfig config) { List<CaseInsensitiveString> allPipelineNames = config.getAllPipelineNames(); HashSet<CaseInsensitiveString> currentPipelineNames = new HashSet<>(allPipelineNames); Collection<CaseInsensitiveString> pipelinesToRemove = Sets.difference(lastKnownPipelineNames, currentPipelineNames); Collection<CaseInsensitiveString> pipelinesToAdd = Sets.difference(currentPipelineNames, lastKnownPipelineNames); if (!pipelinesToAdd.isEmpty()) { historyForDashboard.addAll(loadHistoryForPipelines(new ArrayList<>(CaseInsensitiveString.toStringList(pipelinesToAdd)))); } for (CaseInsensitiveString pipelineNameToRemove : new ArrayList<>(pipelinesToRemove)) { clearEntryFor(pipelineNameToRemove); } lastKnownPipelineNames = currentPipelineNames; LOGGER.debug("Loading permissions from authority"); final Map<CaseInsensitiveString, Permissions> pipelinesAndTheirPermissions = permissionsAuthority.pipelinesAndTheirPermissions(); final List<GoDashboardPipeline> pipelines = new ArrayList<>(1024); LOGGER.debug("Populating dashboard pipelines"); config.accept((PipelineGroupVisitor) group -> group.accept(pipelineConfig -> { long start = System.currentTimeMillis(); Permissions permissions = permissionsFor(pipelineConfig, pipelinesAndTheirPermissions); pipelines.add(createGoDashboardPipeline(pipelineConfig, permissions, historyForDashboard, group)); LOGGER.debug("It took {}ms to process pipeline {}", (System.currentTimeMillis() - start), pipelineConfig.getName()); })); LOGGER.debug("Done populating dashboard pipelines"); this.everLoadedCurrentState = true; return pipelines; }