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.

t()

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

@type component() :: {component_type(), term()}

Full representation of particular component.

Link to this type

component_type()

@type component_type() ::
  :input_topic
  | :load_topic
  | :tick_timezip
  | :template
  | :output_sink
  | :timezip

Part of component identifier.

Link to this type

subscription()

@type subscription() :: {component(), subscription_properties()}

Subscription edge defined with destination and props.

Link to this type

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

Link to this function

convert_to_network(scenario_templates)

@spec convert_to_network([Runbox.ScenarioTemplate.t()]) :: t()

Creates base network with only template nodes

Link to this function

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
Link to this function

input_topics(component_network)

@spec input_topics(t()) :: [String.t()]

Return all input topic names that are being subscribed to in component network.

Link to this function

topology_sort(network)

@spec topology_sort(t()) :: [component()]

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.