Interface StreamGraphContext
-
- All Known Implementing Classes:
DefaultStreamGraphContext
@Internal public interface StreamGraphContext
Defines a context for optimizing and working with a read-only view of a StreamGraph. It provides methods to modify StreamEdges and StreamNodes within the StreamGraph.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
StreamGraphContext.StreamGraphUpdateListener
Interface for observers that monitor the status of a StreamGraph.
-
Method Summary
All Methods Instance Methods Abstract 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.
-
-
-
Method Detail
-
getStreamGraph
ImmutableStreamGraph getStreamGraph()
Returns a read-only view of the StreamGraph.- Returns:
- a read-only view of the StreamGraph.
-
getOperatorFactory
@Nullable StreamOperatorFactory<?> getOperatorFactory(Integer streamNodeId)
Retrieves theStreamOperatorFactory
for the specified stream node id.- Parameters:
streamNodeId
- the id of the stream node- Returns:
- the
StreamOperatorFactory
associated with the givenstreamNodeId
, ornull
if no operator factory is available.
-
modifyStreamEdge
boolean modifyStreamEdge(List<StreamEdgeUpdateRequestInfo> requestInfos)
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.
- Parameters:
requestInfos
- the stream edges to be modified.- Returns:
- true if all modifications were successful and applied atomically, false otherwise.
-
modifyStreamNode
boolean modifyStreamNode(List<StreamNodeUpdateRequestInfo> requestInfos)
Modifies stream nodes within the StreamGraph.- Parameters:
requestInfos
- the stream nodes to be modified.- Returns:
- true if the modification was successful, false otherwise.
-
checkUpstreamNodesFinished
boolean checkUpstreamNodesFinished(ImmutableStreamNode streamNode, @Nullable Integer typeNumber)
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.- Parameters:
streamNode
- the stream node that needs to be determined.- Returns:
- true if all upstream nodes are finished, false otherwise.
-
getConsumedIntermediateDataSetId
IntermediateDataSetID getConsumedIntermediateDataSetId(String edgeId)
Retrieves the IntermediateDataSetID consumed by the specified edge.- Parameters:
edgeId
- id of the edge- Returns:
- the consumed IntermediateDataSetID
-
getOutputPartitioner
@Nullable StreamPartitioner<?> getOutputPartitioner(String edgeId, Integer sourceId, Integer targetId)
Gets the output partitioner of the specified edge.- Parameters:
edgeId
- id of the edgesourceId
- source node id of the edgetargetId
- target node id of the edge- Returns:
- the output partitioner
-
-