Interface ChunkFinder
- All Known Implementing Classes:
BlockChunkFinder,LabelledChunkFinder
public interface ChunkFinder
Think of this as setting conditions to mark a region of interest in the graph of
FlowNode from a FlowExecution.
This is used to define a linear "chunk" from the graph of FlowNodes returned by a ForkScanner, after it applies ordering.
This is done by invoking ForkScanner.visitSimpleChunks(SimpleChunkVisitor, ChunkFinder).
Your SimpleChunkVisitor will receive callbacks about chunk boundaries on the basis of the ChunkFinder.
It is responsible for tracking the state based on events fired.
Common uses:
- Find all
FlowNodes within a specific block type, such the block created by a timeout block, 'node' (executor) block, etc - Find all
FlowNodes between specific markers, such as labels, milestones, or steps generating an error
Implementation Notes:
- This can be used to detect both block-delimited regions of interest and marker-based regions
- Block-delimited regions should END when encountering the right kind of
BlockEndNodeand start when seeing the right kind ofBlockStartNode - Marker-based regions should start when you find the marker, and END when the previous node is a marker
- If you need to handle both for the same set of criteria... good grief. See the StageChunkFinder in the pipeline-graph-analysis plugin.
- Author:
- Sam Van Oort
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisChunkEnd(FlowNode current, FlowNode previous) Test if the current node is the end of a chunk (inclusive)booleanisChunkStart(FlowNode current, FlowNode previous) Test if the current node is the start of a new chunk (inclusive)booleanIf true, a chunk is implicitly created whenever we begin.
-
Method Details
-
isStartInsideChunk
boolean isStartInsideChunk()If true, a chunk is implicitly created whenever we begin.If you are matching the start/end of a block, should always return false.
If you are trying to match markers (such as single-node labels or milestones), should always be true.
-
isChunkStart
Test if the current node is the start of a new chunk (inclusive)- Parameters:
current- Node to test for being a start, it will begin the chunk and be includedprevious- Previous node, to use in testing chunk- Returns:
- True if current node is the beginning of chunk
-
isChunkEnd
Test if the current node is the end of a chunk (inclusive)- Parameters:
current- Node to test for being endFor a block, the
BlockEndNodeFor a legacy stage or marker, this will be first node of new stage (previous is the marker)
previous- Previous node, to use in testing chunk- Returns:
- True if current is the end of a chunk (inclusive)
-