terraform: Graph should overrride Remove to clear lookaside

This commit is contained in:
Mitchell Hashimoto 2015-05-01 11:20:57 -07:00
parent dd14ce9a0b
commit 7e838dfae2
1 changed files with 15 additions and 0 deletions

View File

@ -54,6 +54,21 @@ func (g *Graph) Add(v dag.Vertex) dag.Vertex {
return v
}
// Remove is the same as dag.Graph.Remove
func (g *Graph) Remove(v dag.Vertex) dag.Vertex {
g.once.Do(g.init)
// If this is a depend-able node, then remove the lookaside info
if dv, ok := v.(GraphNodeDependable); ok {
for _, n := range dv.DependableName() {
delete(g.dependableMap, n)
}
}
// Call upwards to remove it from the actual graph
return g.Graph.Remove(v)
}
// ConnectDependent connects a GraphNodeDependent to all of its
// GraphNodeDependables. It returns the list of dependents it was
// unable to connect to.