Grains.Bread (Grains v1.7.0)

A %Bread{} is the compiled version of Recipe plus Grains that allow the Supervisor to run the processes and wire them correctly.

When defining the node implementations an optional startup order can be passed as the last parameter: Grains.new(%{

  A => {ImplA, [], [], 1},
  B => {ImplB, [], [], 2},
  C => {ImplC, [], [], 3}
})

This will create child specs of the given processes in ascending order.

Link to this section Summary

Functions

Takes a recipe, grains and optionally a map of default implementations and returns a bread. Does not start any processes yet.

Generates a random atom to be used as an id for the Bread

Retrieve all ghosts of short_name.

Retrieve all cycle-free paths between first and last.

Retrieve all predecessors of short_name.

Retrieve all cycle-free pull-paths between first and last.

Retrieve all routes of short_name.

Retrieve all successors of short_name.

Link to this section Types

Specs

t() :: %Grains.Bread{
  child_specs: term(),
  final_grains: term(),
  final_recipe: term(),
  ghost_recipe: term(),
  id: term(),
  name: term(),
  original_grains: term(),
  original_recipe: term(),
  process_map: term(),
  routes: term(),
  sup: term()
}

Link to this section Functions

Link to this function

bake(recipe, grains, args \\ [])

Takes a recipe, grains and optionally a map of default implementations and returns a bread. Does not start any processes yet.

Optional Arguments

  • :id Set a custom bread id

Generates a random atom to be used as an id for the Bread

Link to this function

ghosts(bread, short_name)

Retrieve all ghosts of short_name.

Link to this function

paths_between(bread, first, last)

Retrieve all cycle-free paths between first and last.

Link to this function

predecessors(bread, short_name)

Retrieve all predecessors of short_name.

Link to this function

pull_paths_between(bread, first, last)

Retrieve all cycle-free pull-paths between first and last.

Link to this function

routes(bread, short_name)

Retrieve all routes of short_name.

Link to this function

successors(bread, short_name)

Retrieve all successors of short_name.