public class DAG extends Object implements IdentifiedDataSerializable, Iterable<Vertex>
vertex
represents a unit of data processing and an
edge
represents the path along which the data travels to
the next vertex.
The work of a single vertex is parallelized and distributed, so that there are
several instances of the Processor
type on each member
corresponding to it. Whenever possible, each instance should be
tasked with only a slice of the total data and a partitioning strategy
can be employed to ensure that the data sent to each vertex is collated
by a partitioning key.
There are three basic kinds of vertices:
Constructor and Description |
---|
DAG() |
Modifier and Type | Method and Description |
---|---|
DAG |
edge(Edge edge)
Adds an edge to this DAG.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
List<Edge> |
getInboundEdges(String vertexName)
Returns the inbound edges connected to the vertex with the given name.
|
List<Edge> |
getOutboundEdges(String vertexName)
Returns the outbound edges connected to the vertex with the given name.
|
Vertex |
getVertex(String vertexName)
Returns the vertex with the given name.
|
Iterator<Vertex> |
iterator()
Returns an iterator over the DAG's vertices in topological order.
|
Vertex |
newVertex(String name,
DistributedSupplier<? extends Processor> simpleSupplier)
Creates a vertex from a
Supplier<Processor> and adds it to this DAG. |
Vertex |
newVertex(String name,
ProcessorMetaSupplier metaSupplier)
Creates a vertex from a
ProcessorMetaSupplier and adds it to this DAG. |
Vertex |
newVertex(String name,
ProcessorSupplier processorSupplier)
Creates a vertex from a
ProcessorSupplier and adds it to this DAG. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toString() |
String |
toString(int defaultLocalParallelism)
Returns a string representation of the DAG.
|
DAG |
vertex(Vertex vertex)
Adds a vertex to this DAG.
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Vertex newVertex(String name, DistributedSupplier<? extends Processor> simpleSupplier)
Supplier<Processor>
and adds it to this DAG.name
- the unique name of the vertexsimpleSupplier
- the simple, parameterless supplier of Processor
instancesVertex.Vertex(String, DistributedSupplier)
public Vertex newVertex(String name, ProcessorSupplier processorSupplier)
ProcessorSupplier
and adds it to this DAG.name
- the unique name of the vertexprocessorSupplier
- the supplier of Processor
instances which will be used on all membersVertex.Vertex(String, ProcessorSupplier)
public Vertex newVertex(String name, ProcessorMetaSupplier metaSupplier)
ProcessorMetaSupplier
and adds it to this DAG.name
- the unique name of the vertexmetaSupplier
- the meta-supplier of ProcessorSupplier
s for each memberVertex.Vertex(String, ProcessorMetaSupplier)
public DAG edge(Edge edge)
public List<Edge> getInboundEdges(String vertexName)
public List<Edge> getOutboundEdges(String vertexName)
public Iterator<Vertex> iterator()
public String toString(int defaultLocalParallelism)
defaultLocalParallelism
- the local parallelism that will be shown if
neither overridden on the vertex nor the
preferred parallelism is defined by
meta-supplierpublic void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
Copyright © 2018 Hazelcast, Inc.. All rights reserved.