Interface GraphLookupView

  • All Known Implementing Classes:
    FlowExecution, StandardGraphLookupView

    public interface GraphLookupView
    Interface that can be exposed by objects providing means to easily look up information about the structure of a pipeline run Usually this is scoped to a specific FlowExecution. Exists because we do not want to ourselves to only using the standard implementation in StandardGraphLookupView. Implementation note:

    Normally this should only be used internally to power APIs, but if exposed publicly remember that FlowNodes from different executions may be given as inputs. There needs to be a way to handle that. Either throw IllegalArgumentExceptions if tied to a single FlowExecution or FlowExecutionOwner or use the ID of the execution as a key to delegate to different cache objects.

    • Method Detail

      • isActive

        boolean isActive​(@NonNull
                         FlowNode node)
        Tests if the node is a currently running head, or the start of a block that has not completed executing
      • getEndNode

        @CheckForNull
        BlockEndNode getEndNode​(@NonNull
                                BlockStartNode startNode)
        Find the end node corresponding to a start node, and can be used to tell if the block is completed.
        Returns:
        BlockEndNode matching the given start node, or null if block hasn't completed
      • findEnclosingBlockStart

        @CheckForNull
        BlockStartNode findEnclosingBlockStart​(@NonNull
                                               FlowNode node)
        Find the immediately enclosing BlockStartNode around a FlowNode
        Parameters:
        node - Node to find block enclosing it - note that it this is a BlockStartNode, you will return the start of the block enclosing this one.
        Returns:
        Null if node is a FlowStartNode or FlowEndNode
      • iterateEnclosingBlocks

        Iterable<BlockStartNode> iterateEnclosingBlocks​(@NonNull
                                                        FlowNode node)
        Provide an Iterable over all enclosing blocks, which can be used similarly to findAllEnclosingBlockStarts(FlowNode) but does lazy fetches rather than materializing a full result. Handy for for-each loops.

        Usage note:Prefer this to findAllEnclosingBlockStarts(FlowNode) in most cases since it can evaluate lazily, unless you know you need all enclosing blocks.

        Parameters:
        node - Node to find enclosing blocks for
        Returns:
        Iterable over enclosing blocks, from the nearest-enclosing outward ("inside-out" order)
      • findAllEnclosingBlockStarts

        @NonNull
        List<BlockStartNode> findAllEnclosingBlockStarts​(@NonNull
                                                         FlowNode node)
        Return all enclosing block start nodes, as with findEnclosingBlockStart(FlowNode).

        Usage note:Prefer using iterateEnclosingBlocks(FlowNode) unless you know you need ALL blocks, since that can lazy-load.

        Parameters:
        node - Node to find enclosing blocks for
        Returns:
        All enclosing block starts from the nearest-enclosing outward ("inside-out" order), or EMPTY_LIST if this is a start or end node