Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
terraform removed depgraph, so vendor depgraph and digraph
- Loading branch information
Showing
16 changed files
with
2,442 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package depgraph | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ctdk/goiardi/digraph" | ||
) | ||
|
||
// 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 | ||
type Dependency struct { | ||
Name string | ||
Meta interface{} | ||
Constraints []Constraint | ||
Source *Noun | ||
Target *Noun | ||
} | ||
|
||
// Constraint is used by dependencies to allow arbitrary constraints | ||
// between nouns | ||
type Constraint interface { | ||
Satisfied(head, tail *Noun) (bool, error) | ||
} | ||
|
||
// Head returns the source, or dependent noun | ||
func (d *Dependency) Head() digraph.Node { | ||
return d.Source | ||
} | ||
|
||
// Tail returns the target, or depended upon noun | ||
func (d *Dependency) Tail() digraph.Node { | ||
return d.Target | ||
} | ||
|
||
func (d *Dependency) GoString() string { | ||
return fmt.Sprintf( | ||
"*Dependency{Name: %s, Source: %s, Target: %s}", | ||
d.Name, | ||
d.Source.Name, | ||
d.Target.Name) | ||
} | ||
|
||
func (d *Dependency) String() string { | ||
return d.Name | ||
} |
Oops, something went wrong.