@Alpha public class BaseFlowGraph extends Object implements FlowGraph
FlowGraph. The implementation maintains the following data structures:
dataNodeMap - the mapping from a node identifier to the DataNode instance
nodesToEdges - the mapping from each DataNode to its outgoing FlowEdges
flowEdgeMap - the mapping from a edge label to the FlowEdge instance
FlowGraph is synchronized via a ReentrantReadWriteLock.| Constructor and Description |
|---|
BaseFlowGraph() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDataNode(DataNode node)
|
boolean |
addFlowEdge(FlowEdge edge)
|
boolean |
deleteDataNode(DataNode node)
Delete a from the
FlowGraph. |
boolean |
deleteDataNode(String nodeId)
Delete a
DataNode by its identifier |
boolean |
deleteFlowEdge(FlowEdge edge)
Delete a from the
FlowGraph. |
boolean |
deleteFlowEdge(String edgeId)
Delete a
DataNode by its identifier |
FlowGraphPath |
findPath(FlowSpec flowSpec)
A method that takes a
FlowSpec containing the source and destination DataNodes, as well as the
source and target DatasetDescriptors, and returns a sequence
of fully resolved JobSpecs that will move the source dataset
from the source datanode, perform any necessary transformations and land the dataset at the destination node
in the format described by the target DatasetDescriptor. |
Set<FlowEdge> |
getEdges(DataNode node)
Get the set of edges adjacent to a
DataNode |
Set<FlowEdge> |
getEdges(String nodeId)
Get the set of edges adjacent to a
DataNode |
DataNode |
getNode(String nodeId)
Lookup a node by its identifier.
|
public boolean addDataNode(DataNode node)
DataNode to the FlowGraph. If the node already "exists" in the FlowGraph (i.e. the
FlowGraph already has another node with the same id), we remove the old node and add the new one. The
edges incident on the old node are preserved.addDataNode in interface FlowGraphnode - to be added to the FlowGraphFlowGraph.public boolean addFlowEdge(FlowEdge edge)
FlowEdge to the FlowGraph. Addition of edge succeeds only if both the end points of the
edge are already nodes in the FlowGraph. If a FlowEdge already exists, the old FlowEdge is removed and
the new one added in its place.addFlowEdge in interface FlowGraphedge - public boolean deleteDataNode(String nodeId)
DataNode by its identifierdeleteDataNode in interface FlowGraphnodeId - identifier of the DataNode to be deleted.DataNode is successfully deleted.public boolean deleteDataNode(DataNode node)
FlowGraph.node - to be deleted.DataNode is successfully deleted.public boolean deleteFlowEdge(String edgeId)
DataNode by its identifierdeleteFlowEdge in interface FlowGraphedgeId - identifier of the FlowEdge to be deleted.FlowEdge is successfully deleted.public FlowGraphPath findPath(FlowSpec flowSpec) throws PathFinder.PathFinderException, ReflectiveOperationException
FlowSpec containing the source and destination DataNodes, as well as the
source and target DatasetDescriptors, and returns a sequence
of fully resolved JobSpecs that will move the source dataset
from the source datanode, perform any necessary transformations and land the dataset at the destination node
in the format described by the target DatasetDescriptor.findPath in interface FlowGraphflowSpec - a Spec containing a high-level description of input flow.FlowGraphPath that encapsulates a sequence of JobSpecs
satisfying flowSpec.PathFinder.PathFinderExceptionReflectiveOperationException