graph

package
v0.0.0-...-d04b29a Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package graph parses and generates build graphs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByName

type ByName []*Node

ByName sorts dependencies by name so we can have reproduceable builds.

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type Graph

type Graph struct {
	Root *Node

	Nodes map[string]*Node
	// contains filtered or unexported fields
}

Graph represents a build graph

func New

func New(wd, target string) (*Graph, error)

New returns a new build graph relatvie to the working directory

func (*Graph) Workspace

func (g *Graph) Workspace() workspace.Workspace

Workspace returns the Workspace in which this graph exists.

type Node

type Node struct {
	IsRoot        bool       `json:"-"`
	Target        build.Rule `json:"-"`
	Type          string
	Parents       map[string]*Node `json:"-"`
	Label         label.Label
	Worker        string
	PriorityCount int
	WG            sync.WaitGroup
	Status        build.Status
	Cached        bool
	Start, End    int64
	Hash          string
	Output        string `json:"-"`
	Once          sync.Once
	sync.Mutex
	Children map[string]*Node
	// contains filtered or unexported fields
}

Node encapsulates a target and represents a node in the build graph.

func NewNode

func NewNode(l label.Label, t build.Rule) Node

NewNode takes a label and a rule and returns it as a Graph Node

func (*Node) HashNode

func (n *Node) HashNode() []byte

HashNode calculates the hash of a node

func (*Node) Priority

func (n *Node) Priority() int

Priority counts how many nodes directly and indirectly depend on this node

Jump to

Keyboard shortcuts

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