terraform: remove graph config node file

This commit is contained in:
Mitchell Hashimoto 2017-01-26 20:16:06 -08:00
parent 348cfa0ed7
commit c1e4bd7b72
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 12 additions and 36 deletions

View File

@ -1,33 +0,0 @@
package terraform
import (
"github.com/hashicorp/terraform/dag"
)
// graphNodeConfig is an interface that all graph nodes for the
// configuration graph need to implement in order to build the variable
// dependencies properly.
type graphNodeConfig interface {
dag.NamedVertex
// All graph nodes should be dependent on other things, and able to
// be depended on.
GraphNodeDependable
GraphNodeDependent
}
// GraphNodeAddressable is an interface that all graph nodes for the
// configuration graph need to implement in order to be be addressed / targeted
// properly.
type GraphNodeAddressable interface {
ResourceAddress() *ResourceAddress
}
// GraphNodeTargetable is an interface for graph nodes to implement when they
// need to be told about incoming targets. This is useful for nodes that need
// to respect targets as they dynamically expand. Note that the list of targets
// provided will contain every target provided, and each implementing graph
// node must filter this list to targets considered relevant.
type GraphNodeTargetable interface {
SetTargets([]ResourceAddress)
}

View File

@ -6,6 +6,15 @@ import (
"github.com/hashicorp/terraform/dag"
)
// GraphNodeTargetable is an interface for graph nodes to implement when they
// need to be told about incoming targets. This is useful for nodes that need
// to respect targets as they dynamically expand. Note that the list of targets
// provided will contain every target provided, and each implementing graph
// node must filter this list to targets considered relevant.
type GraphNodeTargetable interface {
SetTargets([]ResourceAddress)
}
// TargetsTransformer is a GraphTransformer that, when the user specifies a
// list of resources to target, limits the graph to only those resources and
// their dependencies.
@ -40,7 +49,7 @@ func (t *TargetsTransformer) Transform(g *Graph) error {
for _, v := range g.Vertices() {
removable := false
if _, ok := v.(GraphNodeAddressable); ok {
if _, ok := v.(GraphNodeResource); ok {
removable = true
}
if vr, ok := v.(RemovableIfNotTargeted); ok {
@ -108,12 +117,12 @@ func (t *TargetsTransformer) selectTargetedNodes(
func (t *TargetsTransformer) nodeIsTarget(
v dag.Vertex, addrs []ResourceAddress) bool {
r, ok := v.(GraphNodeAddressable)
r, ok := v.(GraphNodeResource)
if !ok {
return false
}
addr := r.ResourceAddress()
addr := r.ResourceAddr()
for _, targetAddr := range addrs {
if targetAddr.Equals(addr) {
return true