/
githubmirror
/
terraform
Обзор
Документация
Войти
/
githubmirror
/
terraform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
internal/moduletest/graph/transform_close_graph.go
39 строк
1 KB
James Bardin
rename Up and Down edges
03 авг 2026, 17:17
03 авг 2026, 17:17
15c8050
Код
Авторство
О чём код?
// Copyright IBM Corp. 2014, 2026 // SPDX-License-Identifier: BUSL-1.1 package graph import ( "github.com/hashicorp/terraform/internal/dag" "github.com/hashicorp/terraform/internal/terraform" ) // CloseTestGraphTransformer is a GraphTransformer that adds a closing node to the graph. type CloseTestGraphTransformer struct{} func (t *CloseTestGraphTransformer) Transform(g *terraform.Graph) error { closeRoot := &nodeCloseTest{} g.Add(closeRoot) for v := range dag.ExcludeSeq[*nodeCloseTest](g.VerticesSeq()) { // since this is closing the graph, make it depend on everything in // the graph that does not have a parent. Such nodes are the real roots // of the graph, and since they are now siblings of the closing root node, // they are allowed to run in parallel. if g.EdgesTo(v).Len() == 0 { g.Connect(closeRoot, v) } } return nil } // This node doesn't do anything, it's just to ensure that we have a single // root node that depends on everything in the graph. The nodes that it depends // on are the real roots of the graph. type nodeCloseTest struct { } func (n *nodeCloseTest) Name() string { return "testcloser" }