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 booleancheckUpstreamNodesFinished(ImmutableStreamNode streamNode, Integer typeNumber)Check if the upstream nodes of the stream node with the specified type number have finished.IntermediateDataSetIDgetConsumedIntermediateDataSetId(String edgeId)Retrieves the IntermediateDataSetID consumed by the specified edge.StreamOperatorFactory<?>getOperatorFactory(Integer streamNodeId)Retrieves theStreamOperatorFactoryfor the specified stream node id.StreamPartitioner<?>getOutputPartitioner(String edgeId, Integer sourceId, Integer targetId)Gets the output partitioner of the specified edge.ImmutableStreamGraphgetStreamGraph()Returns a read-only view of the StreamGraph.booleanmodifyStreamEdge(List<StreamEdgeUpdateRequestInfo> requestInfos)Atomically modifies stream edges within the StreamGraph.booleanmodifyStreamNode(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:StreamGraphContextReturns a read-only view of the StreamGraph.- Specified by:
getStreamGraphin interfaceStreamGraphContext- Returns:
- a read-only view of the StreamGraph.
-
getOperatorFactory
@Nullable public StreamOperatorFactory<?> getOperatorFactory(Integer streamNodeId)
Description copied from interface:StreamGraphContextRetrieves theStreamOperatorFactoryfor the specified stream node id.- Specified by:
getOperatorFactoryin interfaceStreamGraphContext- Parameters:
streamNodeId- the id of the stream node- Returns:
- the
StreamOperatorFactoryassociated with the givenstreamNodeId, ornullif no operator factory is available.
-
modifyStreamEdge
public boolean modifyStreamEdge(List<StreamEdgeUpdateRequestInfo> requestInfos)
Description copied from interface:StreamGraphContextAtomically 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:
modifyStreamEdgein 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:StreamGraphContextModifies stream nodes within the StreamGraph.- Specified by:
modifyStreamNodein 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:StreamGraphContextCheck 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:
checkUpstreamNodesFinishedin 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:StreamGraphContextRetrieves the IntermediateDataSetID consumed by the specified edge.- Specified by:
getConsumedIntermediateDataSetIdin 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:StreamGraphContextGets the output partitioner of the specified edge.- Specified by:
getOutputPartitionerin interfaceStreamGraphContext- Parameters:
edgeId- id of the edgesourceId- source node id of the edgetargetId- target node id of the edge- Returns:
- the output partitioner
-
-