graph

package
v2.25.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package graph implements logic for dependency graphs and resource sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyGraph

type DependencyGraph struct {
	// contains filtered or unexported fields
}

DependencyGraph represents a dependency graph encoded within a resource snapshot.

func NewDependencyGraph

func NewDependencyGraph(resources []*resource.State) *DependencyGraph

NewDependencyGraph creates a new DependencyGraph from a list of resources. The resources should be in topological order with respect to their dependencies.

func (*DependencyGraph) DependenciesOf

func (dg *DependencyGraph) DependenciesOf(res *resource.State) ResourceSet

DependenciesOf returns a ResourceSet of resources upon which the given resource depends. The resource's parent is included in the returned set.

func (*DependencyGraph) DependingOn

func (dg *DependencyGraph) DependingOn(res *resource.State, ignore map[resource.URN]bool) []*resource.State

DependingOn returns a slice containing all resources that directly or indirectly depend upon the given resource. The returned slice is guaranteed to be in topological order with respect to the snapshot dependency graph.

The time complexity of DependingOn is linear with respect to the number of resources.

type ResourceSet

type ResourceSet map[*resource.State]bool

ResourceSet represents a set of Resources.

func (ResourceSet) Intersect

func (s ResourceSet) Intersect(other ResourceSet) ResourceSet

Intersect returns a new set that is the intersection of the two given resource sets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL