graph

package
v0.0.0-...-57fe177 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package graph implements graph traversal and creation algorithms for the recipe dependency tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Installer

type Installer struct {
	Name         string
	Runner       runner.Installer
	Dependencies []RecipeLoader
}

type Recipe

type Recipe struct {
	Installers []Installer
}

Recipe represents a loaded recipe.

func (Recipe) Traverse

func (r Recipe) Traverse(ctx context.Context, parent string, fn TraverseFn) error

Traverse calls fn for each recipe in it's graph until fn returns false or there are no more entries. Traverse is depth-first. It is eventually called against the Recipe itself.

type RecipeIndex

type RecipeIndex map[string]Recipe

func Generate

func Generate(installers []runner.Installer, rconfig RemoteConfig) (RecipeIndex, error)

Generate produces a graph for each recipe.

func (RecipeIndex) Dump

func (ri RecipeIndex) Dump()

func (RecipeIndex) Traverse

func (ri RecipeIndex) Traverse(ctx context.Context, fn TraverseFn) error

Traverse traverses all recipes in the graph. It will only present recipes that it has presented all dependencies for.

type RecipeLoader

type RecipeLoader interface {
	Load(ctx context.Context) (*Recipe, error)
	Name() string
}

RecipeLoader implements a recipe graph where some recipes may not be loaded yet.

type RemoteConfig

type RemoteConfig struct {
	Path string
}

RemoteConfig configures how we pull dependencies.

type TraverseFn

type TraverseFn func(r runner.Installer) error

func TraverseOnce

func TraverseOnce(fn TraverseFn) TraverseFn

TraverseOnce returns a TraverseFn that only calls fn on each target once.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL