public static final class GraphInterpreter.GraphAssembly
extends java.lang.Object
A GraphAssembly represents a small stream processing graph to be executed by the interpreter. Instances of this class **must not** be mutated after construction.
The array originalAttributes
may contain the attribute information of the original atomic module, otherwise
it must contain a none (otherwise the enclosing module could not overwrite attributes defined in this array).
The arrays ins
and outs
correspond to the notion of a *connection* in the GraphInterpreter
. Each slot
*i* contains the input and output port corresponding to connection *i*. Slots where the graph is not closed (i.e.
ports are exposed to the external world) are marked with *null* values. For example if an input port *p* is
exposed, then outs(p) will contain a *null*.
The arrays inOwners
and outOwners
are lookup tables from a connection id (the index of the slot)
to a slot in the stages
array, indicating which stage is the owner of the given input or output port.
Slots which would correspond to non-existent stages (where the corresponding port is null since it represents
the currently unknown external context) contain the value GraphInterpreter.Boundary()
.
The current assumption by the infrastructure is that the layout of these arrays looks like this:
+---------------------------------------+-----------------+ inOwners: | index to stages array | Boundary (-1) | +----------------+----------------------+-----------------+ ins: | exposed inputs | internal connections | nulls | +----------------+----------------------+-----------------+ outs: | nulls | internal connections | exposed outputs | +----------------+----------------------+-----------------+ outOwners: | Boundary (-1) | index to stages array | +----------------+----------------------------------------+
In addition, it is also assumed by the infrastructure that the order of exposed inputs and outputs in the
corresponding segments of these arrays matches the exact same order of the ports in the Shape
.
Constructor and Description |
---|
GraphAssembly(GraphStageWithMaterializedValue<Shape,java.lang.Object>[] stages,
Attributes[] originalAttributes,
Inlet<?>[] ins,
int[] inOwners,
Outlet<?>[] outs,
int[] outOwners) |
Modifier and Type | Method and Description |
---|---|
int |
connectionCount() |
int[] |
inOwners() |
Inlet<?>[] |
ins() |
scala.Tuple2<GraphInterpreter.Connection[],GraphStageLogic[]> |
materialize(Attributes inheritedAttributes,
StreamLayout.Module[] copiedModules,
java.util.Map<StreamLayout.Module,java.lang.Object> matVal,
scala.Function1<GraphStages.MaterializedValueSource<java.lang.Object>,scala.runtime.BoxedUnit> register)
Takes an interpreter and returns three arrays required by the interpreter containing the input, output port
handlers and the stage logic instances.
|
Attributes[] |
originalAttributes() |
int[] |
outOwners() |
Outlet<?>[] |
outs() |
GraphStageWithMaterializedValue<Shape,java.lang.Object>[] |
stages() |
java.lang.String |
toString() |
public GraphAssembly(GraphStageWithMaterializedValue<Shape,java.lang.Object>[] stages, Attributes[] originalAttributes, Inlet<?>[] ins, int[] inOwners, Outlet<?>[] outs, int[] outOwners)
public GraphStageWithMaterializedValue<Shape,java.lang.Object>[] stages()
public Attributes[] originalAttributes()
public Inlet<?>[] ins()
public int[] inOwners()
public Outlet<?>[] outs()
public int[] outOwners()
public int connectionCount()
public scala.Tuple2<GraphInterpreter.Connection[],GraphStageLogic[]> materialize(Attributes inheritedAttributes, StreamLayout.Module[] copiedModules, java.util.Map<StreamLayout.Module,java.lang.Object> matVal, scala.Function1<GraphStages.MaterializedValueSource<java.lang.Object>,scala.runtime.BoxedUnit> register)
Returns a tuple of - lookup table for Connections - array of the logics
inheritedAttributes
- (undocumented)copiedModules
- (undocumented)matVal
- (undocumented)register
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object