Class DefaultStreamGraphContext
- java.lang.Object
-
- org.apache.flink.streaming.api.graph.DefaultStreamGraphContext
-
- All Implemented Interfaces:
StreamGraphContext
@Internal public class DefaultStreamGraphContext extends Object implements StreamGraphContext
Default implementation forStreamGraphContext
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.graph.StreamGraphContext
StreamGraphContext.StreamGraphUpdateListener
-
-
Constructor Summary
Constructors Constructor Description DefaultStreamGraphContext(StreamGraph streamGraph, Map<Integer,StreamNodeForwardGroup> steamNodeIdToForwardGroupMap, Map<Integer,Integer> frozenNodeToStartNodeMap, Map<Integer,Map<StreamEdge,NonChainedOutput>> opIntermediateOutputsCaches, Map<String,IntermediateDataSet> consumerEdgeIdToIntermediateDataSetMap, Set<Integer> finishedStreamNodeIds, ClassLoader userClassloader)
DefaultStreamGraphContext(StreamGraph streamGraph, Map<Integer,StreamNodeForwardGroup> steamNodeIdToForwardGroupMap, Map<Integer,Integer> frozenNodeToStartNodeMap, Map<Integer,Map<StreamEdge,NonChainedOutput>> opIntermediateOutputsCaches, Map<String,IntermediateDataSet> consumerEdgeIdToIntermediateDataSetMap, Set<Integer> finishedStreamNodeIds, ClassLoader userClassloader, StreamGraphContext.StreamGraphUpdateListener streamGraphUpdateListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkUpstreamNodesFinished(ImmutableStreamNode streamNode, Integer typeNumber)
Check if the upstream nodes of the stream node with the specified type number have finished.IntermediateDataSetID
getConsumedIntermediateDataSetId(String edgeId)
Retrieves the IntermediateDataSetID consumed by the specified edge.StreamOperatorFactory<?>
getOperatorFactory(Integer streamNodeId)
Retrieves theStreamOperatorFactory
for the specified stream node id.StreamPartitioner<?>
getOutputPartitioner(String edgeId, Integer sourceId, Integer targetId)
Gets the output partitioner of the specified edge.ImmutableStreamGraph
getStreamGraph()
Returns a read-only view of the StreamGraph.boolean
modifyStreamEdge(List<StreamEdgeUpdateRequestInfo> requestInfos)
Atomically modifies stream edges within the StreamGraph.boolean
modifyStreamNode(List<StreamNodeUpdateRequestInfo> requestInfos)
Modifies stream nodes within the StreamGraph.
-
-
-
Constructor Detail
-
DefaultStreamGraphContext
@VisibleForTesting public DefaultStreamGraphContext(StreamGraph streamGraph, Map<Integer,StreamNodeForwardGroup> steamNodeIdToForwardGroupMap, Map<Integer,Integer> frozenNodeToStartNodeMap, Map<Integer,Map<StreamEdge,NonChainedOutput>> opIntermediateOutputsCaches, Map<String,IntermediateDataSet> consumerEdgeIdToIntermediateDataSetMap, Set<Integer> finishedStreamNodeIds, ClassLoader userClassloader)
-
DefaultStreamGraphContext
public DefaultStreamGraphContext(StreamGraph streamGraph, Map<Integer,StreamNodeForwardGroup> steamNodeIdToForwardGroupMap, Map<Integer,Integer> frozenNodeToStartNodeMap, Map<Integer,Map<StreamEdge,NonChainedOutput>> opIntermediateOutputsCaches, Map<String,IntermediateDataSet> consumerEdgeIdToIntermediateDataSetMap, Set<Integer> finishedStreamNodeIds, ClassLoader userClassloader, @Nullable StreamGraphContext.StreamGraphUpdateListener streamGraphUpdateListener)
-
-
Method Detail
-
getStreamGraph
public ImmutableStreamGraph getStreamGraph()
Description copied from interface:StreamGraphContext
Returns a read-only view of the StreamGraph.- Specified by:
getStreamGraph
in interfaceStreamGraphContext
- Returns:
- a read-only view of the StreamGraph.
-
getOperatorFactory
@Nullable public StreamOperatorFactory<?> getOperatorFactory(Integer streamNodeId)
Description copied from interface:StreamGraphContext
Retrieves theStreamOperatorFactory
for the specified stream node id.- Specified by:
getOperatorFactory
in interfaceStreamGraphContext
- Parameters:
streamNodeId
- the id of the stream node- Returns:
- the
StreamOperatorFactory
associated with the givenstreamNodeId
, ornull
if no operator factory is available.
-
modifyStreamEdge
public boolean modifyStreamEdge(List<StreamEdgeUpdateRequestInfo> requestInfos)
Description copied from interface:StreamGraphContext
Atomically modifies stream edges within the StreamGraph.This method ensures that all the requested modifications to stream edges are applied atomically. This means that if any modification fails, none of the changes will be applied, maintaining the consistency of the StreamGraph.
- Specified by:
modifyStreamEdge
in interfaceStreamGraphContext
- Parameters:
requestInfos
- the stream edges to be modified.- Returns:
- true if all modifications were successful and applied atomically, false otherwise.
-
modifyStreamNode
public boolean modifyStreamNode(List<StreamNodeUpdateRequestInfo> requestInfos)
Description copied from interface:StreamGraphContext
Modifies stream nodes within the StreamGraph.- Specified by:
modifyStreamNode
in interfaceStreamGraphContext
- Parameters:
requestInfos
- the stream nodes to be modified.- Returns:
- true if the modification was successful, false otherwise.
-
checkUpstreamNodesFinished
public boolean checkUpstreamNodesFinished(ImmutableStreamNode streamNode, Integer typeNumber)
Description copied from interface:StreamGraphContext
Check if the upstream nodes of the stream node with the specified type number have finished. If the type number is null, evaluate the completion of all upstream processes.- Specified by:
checkUpstreamNodesFinished
in interfaceStreamGraphContext
- Parameters:
streamNode
- the stream node that needs to be determined.- Returns:
- true if all upstream nodes are finished, false otherwise.
-
getConsumedIntermediateDataSetId
public IntermediateDataSetID getConsumedIntermediateDataSetId(String edgeId)
Description copied from interface:StreamGraphContext
Retrieves the IntermediateDataSetID consumed by the specified edge.- Specified by:
getConsumedIntermediateDataSetId
in interfaceStreamGraphContext
- Parameters:
edgeId
- id of the edge- Returns:
- the consumed IntermediateDataSetID
-
getOutputPartitioner
public StreamPartitioner<?> getOutputPartitioner(String edgeId, Integer sourceId, Integer targetId)
Description copied from interface:StreamGraphContext
Gets the output partitioner of the specified edge.- Specified by:
getOutputPartitioner
in interfaceStreamGraphContext
- Parameters:
edgeId
- id of the edgesourceId
- source node id of the edgetargetId
- target node id of the edge- Returns:
- the output partitioner
-
-