graph

package
v0.0.0-...-506879c Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultResourceGraph

func NewDefaultResourceGraph() *defaultResourceGraph

NewDefaultResourceGraph constructs new defaultResourceGraph.

func TopologicalTraversal

func TopologicalTraversal(graph ResourceGraph, visitFunc func(uid ResourceUID) error) error

TopologicalTraversal will traversal nodes in typological order. @TODO: change this traversal to be parallel.

Types

type ResourceGraph

type ResourceGraph interface {
	// Add a node into ResourceGraph.
	AddNode(node ResourceUID)

	// Add a edge into ResourceGraph, where dstNode depends on srcNode.
	AddEdge(srcNode ResourceUID, dstNode ResourceUID)

	// Nodes returns all nodes in ResourceGraph.
	Nodes() []ResourceUID

	// OutEdgeNodes returns all nodes that depends on this node.
	OutEdgeNodes(node ResourceUID) []ResourceUID
}

ResourceGraph is an abstraction of resource DAG.

type ResourceUID

type ResourceUID struct {
	ResType reflect.Type
	ResID   string
}

unique ID for a resource.

Jump to

Keyboard shortcuts

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