Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentDependencies ¶
type ComponentDependencies map[string]WeightedDeps
ComponentDependencies holds a complete representation of all dependencies from upstream to downstream dependencies for all components. Dependencies are weighted by their distance to the reference component (the top-level key)
weight 0: a direct dependency weight 1: indirect dependency (1 level in between)
E.g.:
A ← + ← C ← E ↑ ↑ + ← D
encoded as
map[ A: map[], C: map[0:map[A:true]], D: map[0:map[A:true, C:true]], E: map[0:map[C:true], 1:map[A:true]] ]
func GenerateUpToDown ¶
func GenerateUpToDown(components DownToUp) ComponentDependencies
GenerateUpToDown constructs a dependency graph that flows from upstream to downstream components (where component A is downstream of C if it depends on C). The graph is constructed from a map of all direct dependencies (given in form downstream to upstream). E.g. the input
A → + → C → E ↓ ↓ + → D
will result in the upstream to downstream graph
A ← + ← C ← E ↑ ↑ + ← D
encoded as
map[ A: map[], C: map[0:map[A:true]], D: map[0:map[A:true, C:true]], E: map[0:map[C:true], 1:map[A:true]] ]
func (ComponentDependencies) Keys ¶
func (cd ComponentDependencies) Keys() []string
func (ComponentDependencies) MaxDepth ¶
func (cd ComponentDependencies) MaxDepth(m int) ComponentDependencies
func (ComponentDependencies) Print ¶
func (cd ComponentDependencies) Print(w io.Writer, format OutputFormat) error
For each components Print returns the upstream dependencies weighted by the number of links separating them from the component in question. In yaml format the output will have the form
{componentName: {weight: [dependency-1, dependency-2, ...], ...}, ...}
In json format the output will have the form
{componentName: [[dependency-1, dependency-2, ...], ...], ...}
where the outer array is ordered by increasing weights.
type DownToUp ¶
DownToUp is a map from downstream components to all their direct upstream dependencies. E.g. the graph
A -+ → C | + → D
would be encoded as map[A] = {C,D}
type OutputFormat ¶
type OutputFormat string
const ( JSON OutputFormat = "json" YAML OutputFormat = "yaml" FLAT OutputFormat = "flat" UNSET OutputFormat = "unset" )
func CastOutputFormat ¶
func CastOutputFormat(s string) (OutputFormat, bool)
type WeightedDeps ¶
func (WeightedDeps) Keys ¶
func (wd WeightedDeps) Keys() []int
func (WeightedDeps) ToArray ¶
func (wd WeightedDeps) ToArray() [][]string