Oi. Flowgraph
(oi v0.6.3)
Copy Markdown
A higher API for builing graph.
Summary
Functions
DSL entry point. Initialises an empty graph and evaluates the body, returning the fully built graph.
Add multiple steps at once when they share no options.
Add a step to the accumulated graph.
Connect two node ports.
Functions
@spec add_step(Oi.Topology.Graph.t(), module(), keyword()) :: Oi.Topology.Graph.t()
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
Add multiple steps at once when they share no options.
All modules are validated at compile time just like step/1.
Equivalent to calling step for each module with no options.
Example
many_step [LoadPosts, LoadPages, LoadImages]
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
Connect two node ports.
Both sides accept two forms:
node.port— dot-expression{node, port}— explicit tuple