Documentation ¶
Overview ¶
The depgraph package is used to create and model a dependency graph of nouns. Each noun can represent a service, server, application, network switch, etc. Nouns can depend on other nouns, and provide versioning constraints. Nouns can also have various meta data that may be relevant to their construction or configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
Constraint is used by dependencies to allow arbitrary constraints between nouns
type ConstraintError ¶
type ConstraintError struct {
Violations []*Violation
}
ConstraintError is used to return detailed violation information from CheckConstraints
func (*ConstraintError) Error ¶
func (c *ConstraintError) Error() string
type Dependency ¶
type Dependency struct { Name string Meta interface{} Constraints []Constraint Source *Noun Target *Noun }
Dependency is used to create a directed edge between two nouns. One noun may depend on another and provide version constraints that cannot be violated
func (*Dependency) GoString ¶
func (d *Dependency) GoString() string
func (*Dependency) Head ¶
func (d *Dependency) Head() digraph.Node
Head returns the source, or dependent noun
func (*Dependency) String ¶
func (d *Dependency) String() string
func (*Dependency) Tail ¶
func (d *Dependency) Tail() digraph.Node
Tail returns the target, or depended upon noun
type Graph ¶
Graph is used to represent a dependency graph.
func (*Graph) CheckConstraints ¶
CheckConstraints walks the graph and ensures that all user imposed constraints are satisfied.
func (*Graph) DependsOn ¶
DependsOn returns the set of nouns that have a dependency on a given noun. This can be used to find the incoming edges to a noun.
func (*Graph) String ¶
String generates a little ASCII string of the graph, useful in debugging output.
func (*Graph) Validate ¶
Validate is used to ensure that a few properties of the graph are not violated: 1) There must be a single "root", or source on which nothing depends. 2) All nouns in the graph must be reachable from the root 3) The graph must be cycle free, meaning there are no cicular dependencies
type Noun ¶
type Noun struct { Name string // Opaque name Meta interface{} Deps []*Dependency }
Nouns are the key structure of the dependency graph. They can be used to represent all objects in the graph. They are linked by depedencies.
type ValidateError ¶
type ValidateError struct { // If set, then the graph is missing a single root, on which // there are no depdendencies MissingRoot bool // Unreachable are nodes that could not be reached from // the root noun. Unreachable []*Noun // Cycles are groups of strongly connected nodes, which // form a cycle. This is disallowed. Cycles [][]*Noun }
ValidateError implements the Error interface but provides additional information on a validation error.
func (*ValidateError) Error ¶
func (v *ValidateError) Error() string
type Violation ¶
type Violation struct { Source *Noun Target *Noun Dependency *Dependency Constraint Constraint Err error }
Violation is used to pass along information about a constraint violation