Skip to content

Commit

Permalink
terraform removed depgraph, so vendor depgraph and digraph
Browse files Browse the repository at this point in the history
  • Loading branch information
ctdk committed Nov 16, 2015
1 parent 8bacf18 commit 82f664c
Show file tree
Hide file tree
Showing 16 changed files with 2,442 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/cookbook.go
Expand Up @@ -24,12 +24,12 @@ import (
"database/sql"
"fmt"
gversion "github.com/ctdk/go-version"
"github.com/ctdk/goas/v2/logger"
"github.com/tideland/golib/logger"
"github.com/ctdk/goiardi/config"
"github.com/ctdk/goiardi/datastore"
"github.com/ctdk/goiardi/filestore"
"github.com/ctdk/goiardi/util"
"github.com/hashicorp/terraform/depgraph"
"github.com/ctdk/goiardi/depgraph"
"net/http"
"regexp"
"sort"
Expand Down
354 changes: 354 additions & 0 deletions depgraph/LICENSE

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions depgraph/dependency.go
@@ -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
}

0 comments on commit 82f664c

Please sign in to comment.