pulumi/pkg/resource/graph
Will Jones ec1e3dded1
Centralize resource state dependency traversal (#17320)
Resources can depend on others in a number of ways -- provider
references, parent-child relationships, dependencies and property
dependencies, and deleted-with relationships. With all these linkages to
keep track of, it's easy for one to be missed and bugs to be introduced,
and indeed this has happened on numerous occasions. This commit attempts
to make it harder to introduce bugs where dependencies are missed by
adding a new `GetAllDependencies` method to `resource.State`. The idea
is not that this will make all traversals of dependencies shorter and
neater (though in many cases it does), but that it will force iterations
over a resource's dependency set to account for all possible relations
appropriately, and discard any that are not important explicitly.

> [!NOTE]
> In some cases the use of `GetAllDependencies` means that algorithms
> which previously mutated an existing set of properties are
> easier/cleaner to express by building up a new set of dependencies and
> mutating after the loop's completion. This does mean a change of
> performance characteristics in some places but I don't think these are
> significant and for the most part they are off hot paths -- `state
move`
> and `state rename` are the most obvious examples.

Fixes #16746
2024-09-23 08:37:34 +00:00
..
dependency_graph.go Centralize resource state dependency traversal (#17320) 2024-09-23 08:37:34 +00:00
dependency_graph_rapid_test.go Replace ResourceSet with a generic set type (#14724) 2023-12-03 23:20:43 +00:00
dependency_graph_test.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00