View Source Runbox.Runtime.Stage.ComponentNetwork (runbox v17.1.0)

Component network builds and validates template dependency network for StageBased scenario runtime.

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.

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.

Types

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

Full representation of particular component.

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

Part of component identifier.

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

Subscription edge defined with destination and props.

Link to this type

subscription_properties()

View Source
@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.

Functions

Link to this function

convert_to_network(scenario_templates)

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

Creates base network with only template nodes

Link to this function

create(scenario_templates, opts \\ [])

View Source
@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

  • :direct_ticking - if true (default), creates network using direct ticking
Link to this function

input_topics(component_network)

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

Return all input topic names that are being subscribed to in component 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.