Class PipelineGraphViewCache
java.lang.Object
io.jenkins.plugins.pipelinegraphview.utils.PipelineGraphViewCache
Disk-backed cache for the computed pipeline graph and step list of completed runs.
For in-progress runs the cache is transparent (every call recomputes). Once a run is
no longer building, results are persisted as JSON under the run's directory and can be
streamed straight back to HTTP clients without going through Jackson on the read path.
The on-disk format is the same wire JSON the tree / allSteps endpoints
emit (the data portion of the {"status":"ok","data":...} envelope).
tryServeTree(WorkflowRun, OutputStream) / tryServeAllSteps(WorkflowRun, OutputStream) wrap that in the envelope and copy bytes through.
Schema version is encoded in the file name: a future format change just bumps
SCHEMA_VERSION so old files become orphans on disk and are ignored.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PipelineGraphViewCacheget()getAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun run, Supplier<PipelineStepList> compute) getGraph(org.jenkinsci.plugins.workflow.job.WorkflowRun run, Supplier<PipelineGraph> compute) voidseed(org.jenkinsci.plugins.workflow.job.WorkflowRun run, PipelineGraph graph, PipelineStepList allSteps) Writes a final graph and step list directly to disk, bypassing theisBuildingguard ongetGraph(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.util.function.Supplier<io.jenkins.plugins.pipelinegraphview.utils.PipelineGraph>)/getAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.util.function.Supplier<io.jenkins.plugins.pipelinegraphview.utils.PipelineStepList>).booleantryServeAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun run, OutputStream out) tryServeTree(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.io.OutputStream)for the all-steps payload.booleantryServeTree(org.jenkinsci.plugins.workflow.job.WorkflowRun run, OutputStream out) If a cached graph file exists forrun, write it tooutwrapped in the StaplerokJSONenvelope and returntrue.
-
Field Details
-
SCHEMA_VERSION
public static final int SCHEMA_VERSION- See Also:
-
TREE_FILE_NAME
- See Also:
-
ALL_STEPS_FILE_NAME
- See Also:
-
LEGACY_XSTREAM_FILE_NAME
- See Also:
-
-
Method Details
-
get
-
tryServeTree
public boolean tryServeTree(org.jenkinsci.plugins.workflow.job.WorkflowRun run, OutputStream out) throws IOException If a cached graph file exists forrun, write it tooutwrapped in the StaplerokJSONenvelope and returntrue. Otherwise no bytes are written.- Throws:
IOException
-
tryServeAllSteps
public boolean tryServeAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun run, OutputStream out) throws IOException tryServeTree(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.io.OutputStream)for the all-steps payload.- Throws:
IOException
-
getGraph
public PipelineGraph getGraph(org.jenkinsci.plugins.workflow.job.WorkflowRun run, Supplier<PipelineGraph> compute) -
getAllSteps
public PipelineStepList getAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun run, Supplier<PipelineStepList> compute) -
seed
public void seed(org.jenkinsci.plugins.workflow.job.WorkflowRun run, PipelineGraph graph, PipelineStepList allSteps) Writes a final graph and step list directly to disk, bypassing theisBuildingguard ongetGraph(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.util.function.Supplier<io.jenkins.plugins.pipelinegraphview.utils.PipelineGraph>)/getAllSteps(org.jenkinsci.plugins.workflow.job.WorkflowRun, java.util.function.Supplier<io.jenkins.plugins.pipelinegraphview.utils.PipelineStepList>). Intended forFlowExecutionListener.onCompleted, where the execution is known complete butWorkflowRun.isBuilding()may not have flipped yet.
-