Runbox.Runtime.Stage.ComponentNetwork (runbox v7.0.1)
Component network builds and validates template dependency network.
To build this network, module uses Runbox.Scenario.Template.StageBased.subscriptions/0
.
Only templates are defined at first, logic than derive input-topic nodes, timezip where one
template subscribes to two stream, and output sink in the end.
Link to this section Summary
Types
Full representation of particular component.
Part of component identifier.
Subscription edge defined with destination and props.
Additional properties of subscription/edge. E.g. selector for Broadcast dispatcher.
Component network is adjacency graph with subscription edges.
Functions
Creates base network with only template nodes
Main function. Given list of template modules, expands them into components network with input streams, timezips etc...
Return all input topic names that are being subscribed to in component network.
Sorts components (keys) of component network topologicaly, but according to backward edges, because edge means subscription relation (not comes after but comes before). So instead of indegree implementation use outdegee. Its wrath of kahn's algorithm.
Link to this section Types
component()
@type component() :: {component_type(), term()}
Full representation of particular component.
component_type()
@type component_type() ::
:input_topic
| :load_topic
| :tick_timezip
| :template
| :output_sink
| :timezip
Part of component identifier.
subscription()
@type subscription() :: {component(), subscription_properties()}
Subscription edge defined with destination and props.
subscription_properties()
@type subscription_properties() :: term()
Additional properties of subscription/edge. E.g. selector for Broadcast dispatcher.
@type t() :: %{required(component()) => [subscription()]}
Component network is adjacency graph with subscription edges.
Link to this section Functions
convert_to_network(scenario_templates)
@spec convert_to_network([Runbox.ScenarioTemplate.t()]) :: t()
Creates base network with only template nodes
create(scenario_templates, opts \\ [])
@spec create([Runbox.ScenarioTemplate.t()], Keyword.t()) :: {:ok, t()} | {:error, term()}
Main function. Given list of template modules, expands them into components network with input streams, timezips etc...
options
Options
:direct_ticking
- if true (default), creates network using direct ticking
input_topics(component_network)
Return all input topic names that are being subscribed to in component network.
topology_sort(network)
Sorts components (keys) of component network topologicaly, but according to backward edges, because edge means subscription relation (not comes after but comes before). So instead of indegree implementation use outdegee. Its wrath of kahn's algorithm.