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 ofFlowNode
from aFlowExecution
.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
FlowNode
s within a specific block type, such the block created by a timeout block, 'node' (executor) block, etc - Find all
FlowNode
s 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
BlockEndNode
and 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isChunkEnd(FlowNode current, FlowNode previous)
Test if the current node is the end of a chunk (inclusive)boolean
isChunkStart(FlowNode current, FlowNode previous)
Test if the current node is the start of a new chunk (inclusive)boolean
isStartInsideChunk()
If true, a chunk is implicitly created whenever we begin.
-
-
-
Method Detail
-
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
boolean isChunkStart(@NonNull FlowNode current, @CheckForNull FlowNode previous)
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
boolean isChunkEnd(@NonNull FlowNode current, @CheckForNull FlowNode previous)
Test if the current node is the end of a chunk (inclusive)- Parameters:
current
- Node to test for being endFor a block, the
BlockEndNode
For 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)
-
-