Oi.Flowgraph (oi v0.6.0)

Copy Markdown

Summary

Functions

DSL entry point. Initialises an empty graph and evaluates the body, returning the fully built graph.

Add a step to the accumulated graph.

Connect two node ports.

Functions

add_step(graph, oi_step, opts \\ [])

@spec add_step(Oi.Topology.Graph.t(), module(), keyword()) :: Oi.Topology.Graph.t()

belongs_port(key)

(macro)

connect(graph, arg1, arg2)

graph(list)

(macro)

DSL entry point. Initialises an empty graph and evaluates the body, returning the fully built graph.

Example

iex> import Oi.Flowgraph
iex> graph = graph do
...>   step OiTest.DummyOiStep.Greet
...>   step OiTest.DummyOiStep.Exclaim
...>   greet.greeting ~> exclaim.text
...> end
iex> map_size(graph.nodes)
2
iex> MapSet.size(graph.edges)
1

new_flowchart()

See Oi.Topology.Graph.new/0.

step(module, opts \\ [])

(macro)

Add a step to the accumulated graph.

The module must use Oi.Step (i.e. expose __node_spec__/0). Validated at compile time — raises ArgumentError if the module does not implement the expected contract.

Options

  • :as — node alias (default: module's declared name)
  • :opts — keyword list forwarded as step options

left ~> right

(macro)

Connect two node ports.

Both sides accept two forms:

  • node.port — dot-expression
  • {node, port} — explicit tuple