graph

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

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
}

func ComputeDependencyGraph

func ComputeDependencyGraph(items []DependencyItem) (DependencyGraph, error)

ComputeDependencyGraph creates a DependencyGraph from a slice of DependencyItems, validating that all dependencies exist

in the graph and returning an error if any are missing.

func (DependencyGraph) Lookup

func (dg DependencyGraph) Lookup(key string) (DependencySet, bool)

Lookup returns the DependencySet associated with the given key if it exists, and a boolean indicating whether the key was found.

func (DependencyGraph) Order

func (dg DependencyGraph) Order() ([]DependencyItem, error)

Order orders the DependencyItems in the DependencyGraph in a topological order and returns them in a slice, or returns an error if a cycle is detected.

type DependencyItem

type DependencyItem interface {
	Key() string
	GetDependencies() ([]string, error)
}

type DependencySet

type DependencySet interface {
	Key() string
	Item() DependencyItem
	GetDirectDependencies() []DependencySet
	GetTransitiveDependencies() []DependencySet
}

Jump to

Keyboard shortcuts

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