remove unused interfaces

RemovableIfNotTargeted and GraphNodeTargetDownstream are no longer used
by the target transformer.
This commit is contained in:
James Bardin 2020-06-24 10:45:58 -04:00
parent c99157c35b
commit 2fa16c24f7
8 changed files with 2 additions and 137 deletions

View File

@ -18,7 +18,6 @@ type nodeExpandLocal struct {
}
var (
_ RemovableIfNotTargeted = (*nodeExpandLocal)(nil)
_ GraphNodeReferenceable = (*nodeExpandLocal)(nil)
_ GraphNodeReferencer = (*nodeExpandLocal)(nil)
_ GraphNodeDynamicExpandable = (*nodeExpandLocal)(nil)
@ -48,11 +47,6 @@ func (n *nodeExpandLocal) ModulePath() addrs.Module {
return n.Module
}
// RemovableIfNotTargeted
func (n *nodeExpandLocal) RemoveIfNotTargeted() bool {
return true
}
// GraphNodeReferenceable
func (n *nodeExpandLocal) ReferenceableAddrs() []addrs.Referenceable {
return []addrs.Referenceable{n.Addr}
@ -89,7 +83,6 @@ type NodeLocal struct {
var (
_ GraphNodeModuleInstance = (*NodeLocal)(nil)
_ RemovableIfNotTargeted = (*NodeLocal)(nil)
_ GraphNodeReferenceable = (*NodeLocal)(nil)
_ GraphNodeReferencer = (*NodeLocal)(nil)
_ GraphNodeEvalable = (*NodeLocal)(nil)
@ -116,11 +109,6 @@ func (n *NodeLocal) ModulePath() addrs.Module {
return n.Addr.Module.Module()
}
// RemovableIfNotTargeted
func (n *NodeLocal) RemoveIfNotTargeted() bool {
return true
}
// GraphNodeReferenceable
func (n *NodeLocal) ReferenceableAddrs() []addrs.Referenceable {
return []addrs.Referenceable{n.Addr.LocalValue}

View File

@ -22,7 +22,6 @@ type nodeExpandModule struct {
}
var (
_ RemovableIfNotTargeted = (*nodeExpandModule)(nil)
_ GraphNodeEvalable = (*nodeExpandModule)(nil)
_ GraphNodeReferencer = (*nodeExpandModule)(nil)
_ GraphNodeReferenceOutside = (*nodeExpandModule)(nil)
@ -99,13 +98,6 @@ func (n *nodeExpandModule) ReferenceOutside() (selfPath, referencePath addrs.Mod
return n.Addr, n.Addr.Parent()
}
// RemovableIfNotTargeted implementation
func (n *nodeExpandModule) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// GraphNodeEvalable
func (n *nodeExpandModule) EvalTree() EvalNode {
return &evalPrepareModuleExpansion{
@ -146,10 +138,6 @@ func (n *nodeCloseModule) ReferenceableAddrs() []addrs.Referenceable {
}
}
func (n *nodeCloseModule) TargetDownstream(targeted, untargeted dag.Set) bool {
return true
}
func (n *nodeCloseModule) Name() string {
if len(n.Addr) == 0 {
return "root"
@ -157,13 +145,6 @@ func (n *nodeCloseModule) Name() string {
return n.Addr.String() + " (close)"
}
// RemovableIfNotTargeted implementation
func (n *nodeCloseModule) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
func (n *nodeCloseModule) EvalTree() EvalNode {
return &EvalSequence{
Nodes: []EvalNode{

View File

@ -26,7 +26,6 @@ var (
_ GraphNodeReferenceable = (*nodeExpandModuleVariable)(nil)
_ GraphNodeReferencer = (*nodeExpandModuleVariable)(nil)
_ graphNodeTemporaryValue = (*nodeExpandModuleVariable)(nil)
_ RemovableIfNotTargeted = (*nodeExpandModuleVariable)(nil)
_ graphNodeExpandsInstances = (*nodeExpandModuleVariable)(nil)
)
@ -98,16 +97,6 @@ func (n *nodeExpandModuleVariable) ReferenceableAddrs() []addrs.Referenceable {
return []addrs.Referenceable{n.Addr}
}
// RemovableIfNotTargeted
func (n *nodeExpandModuleVariable) RemoveIfNotTargeted() bool {
return true
}
// GraphNodeTargetDownstream
func (n *nodeExpandModuleVariable) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
return true
}
// nodeModuleVariable represents a module variable input during
// the apply step.
type nodeModuleVariable struct {
@ -123,7 +112,6 @@ type nodeModuleVariable struct {
// implementing.
var (
_ GraphNodeModuleInstance = (*nodeModuleVariable)(nil)
_ RemovableIfNotTargeted = (*nodeModuleVariable)(nil)
_ GraphNodeEvalable = (*nodeModuleVariable)(nil)
_ graphNodeTemporaryValue = (*nodeModuleVariable)(nil)
_ dag.GraphNodeDotter = (*nodeModuleVariable)(nil)
@ -149,13 +137,6 @@ func (n *nodeModuleVariable) ModulePath() addrs.Module {
return n.Addr.Module.Module()
}
// RemovableIfNotTargeted
func (n *nodeModuleVariable) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// GraphNodeEvalable
func (n *nodeModuleVariable) EvalTree() EvalNode {
// If we have no value, do nothing

View File

@ -19,7 +19,6 @@ type nodeExpandOutput struct {
}
var (
_ RemovableIfNotTargeted = (*nodeExpandOutput)(nil)
_ GraphNodeReferenceable = (*nodeExpandOutput)(nil)
_ GraphNodeReferencer = (*nodeExpandOutput)(nil)
_ GraphNodeReferenceOutside = (*nodeExpandOutput)(nil)
@ -100,16 +99,6 @@ func (n *nodeExpandOutput) References() []*addrs.Reference {
return appendResourceDestroyReferences(referencesForOutput(n.Config))
}
// RemovableIfNotTargeted
func (n *nodeExpandOutput) RemoveIfNotTargeted() bool {
return true
}
// GraphNodeTargetDownstream
func (n *nodeExpandOutput) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
return true
}
// NodeApplyableOutput represents an output that is "applyable":
// it is ready to be applied.
type NodeApplyableOutput struct {
@ -119,8 +108,6 @@ type NodeApplyableOutput struct {
var (
_ GraphNodeModuleInstance = (*NodeApplyableOutput)(nil)
_ RemovableIfNotTargeted = (*NodeApplyableOutput)(nil)
_ GraphNodeTargetDownstream = (*NodeApplyableOutput)(nil)
_ GraphNodeReferenceable = (*NodeApplyableOutput)(nil)
_ GraphNodeReferencer = (*NodeApplyableOutput)(nil)
_ GraphNodeReferenceOutside = (*NodeApplyableOutput)(nil)
@ -148,21 +135,6 @@ func (n *NodeApplyableOutput) ModulePath() addrs.Module {
return n.Addr.Module.Module()
}
// RemovableIfNotTargeted
func (n *NodeApplyableOutput) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// GraphNodeTargetDownstream
func (n *NodeApplyableOutput) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
// If any of the direct dependencies of an output are targeted then
// the output must always be targeted as well, so its value will always
// be up-to-date at the completion of an apply walk.
return true
}
func referenceOutsideForOutput(addr addrs.AbsOutputValue) (selfPath, referencePath addrs.Module) {
// Output values have their expressions resolved in the context of the
// module where they are defined.
@ -255,10 +227,8 @@ type NodeDestroyableOutput struct {
}
var (
_ RemovableIfNotTargeted = (*NodeDestroyableOutput)(nil)
_ GraphNodeTargetDownstream = (*NodeDestroyableOutput)(nil)
_ GraphNodeEvalable = (*NodeDestroyableOutput)(nil)
_ dag.GraphNodeDotter = (*NodeDestroyableOutput)(nil)
_ GraphNodeEvalable = (*NodeDestroyableOutput)(nil)
_ dag.GraphNodeDotter = (*NodeDestroyableOutput)(nil)
)
func (n *NodeDestroyableOutput) Name() string {
@ -275,19 +245,6 @@ func (n *NodeDestroyableOutput) temporaryValue() bool {
return !n.Addr.Module.IsRoot()
}
// RemovableIfNotTargeted
func (n *NodeDestroyableOutput) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// This will keep the destroy node in the graph if its corresponding output
// node is also in the destroy graph.
func (n *NodeDestroyableOutput) TargetDownstream(targetedDeps, untargetedDeps dag.Set) bool {
return true
}
// GraphNodeEvalable
func (n *NodeDestroyableOutput) EvalTree() EvalNode {
return &EvalDeleteOutput{

View File

@ -27,7 +27,6 @@ type NodeAbstractProvider struct {
var (
_ GraphNodeModulePath = (*NodeAbstractProvider)(nil)
_ RemovableIfNotTargeted = (*NodeAbstractProvider)(nil)
_ GraphNodeReferencer = (*NodeAbstractProvider)(nil)
_ GraphNodeProvider = (*NodeAbstractProvider)(nil)
_ GraphNodeAttachProvider = (*NodeAbstractProvider)(nil)
@ -51,13 +50,6 @@ func (n *NodeAbstractProvider) ModulePath() addrs.Module {
return n.Addr.Module
}
// RemovableIfNotTargeted
func (n *NodeAbstractProvider) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// GraphNodeReferencer
func (n *NodeAbstractProvider) References() []*addrs.Reference {
if n.Config == nil || n.Schema == nil {

View File

@ -15,7 +15,6 @@ type NodeDisabledProvider struct {
var (
_ GraphNodeModulePath = (*NodeDisabledProvider)(nil)
_ RemovableIfNotTargeted = (*NodeDisabledProvider)(nil)
_ GraphNodeReferencer = (*NodeDisabledProvider)(nil)
_ GraphNodeProvider = (*NodeDisabledProvider)(nil)
_ GraphNodeAttachProvider = (*NodeDisabledProvider)(nil)

View File

@ -488,13 +488,6 @@ func (n *graphNodeCloseProvider) DotNode(name string, opts *dag.DotOpts) *dag.Do
}
}
// RemovableIfNotTargeted
func (n *graphNodeCloseProvider) RemoveIfNotTargeted() bool {
// We need to add this so that this node will be removed if
// it isn't targeted or a dependency of a target.
return true
}
// graphNodeProxyProvider is a GraphNodeProvider implementation that is used to
// store the name and value of a provider node for inheritance between modules.
// These nodes are only used to store the data while loading the provider

View File

@ -16,21 +16,6 @@ type GraphNodeTargetable interface {
SetTargets([]addrs.Targetable)
}
// GraphNodeTargetDownstream is an interface for graph nodes that need to
// be remain present under targeting if any of their dependencies are targeted.
// TargetDownstream is called with the set of vertices that are direct
// dependencies for the node, and it should return true if the node must remain
// in the graph in support of those dependencies.
//
// This is used in situations where the dependency edges are representing an
// ordering relationship but the dependency must still be visited if its
// dependencies are visited. This is true for outputs, for example, since
// they must get updated if any of their dependent resources get updated,
// which would not normally be true if one of their dependencies were targeted.
type GraphNodeTargetDownstream interface {
TargetDownstream(targeted, untargeted dag.Set) bool
}
// 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.
@ -174,14 +159,3 @@ func (t *TargetsTransformer) nodeIsTarget(v dag.Vertex, targets []addrs.Targetab
return false
}
// RemovableIfNotTargeted is a special interface for graph nodes that
// aren't directly addressable, but need to be removed from the graph when they
// are not targeted. (Nodes that are not directly targeted end up in the set of
// targeted nodes because something that _is_ targeted depends on them.) The
// initial use case for this interface is GraphNodeConfigVariable, which was
// having trouble interpolating for module variables in targeted scenarios that
// filtered out the resource node being referenced.
type RemovableIfNotTargeted interface {
RemoveIfNotTargeted() bool
}