deps

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Composition

type Composition struct {
	//Distribution is map of: map[DISTRIBUTION-NAME]:map[APP-NAME]:Dependencies
	Distribution map[string]map[string]*Dependencies `json:"distribution"`
}

func CompositionFromDir

func CompositionFromDir(rootdir string, cfgPath string, ignoredDirs []string) (*Composition, error)

CompositionFromDir returns a new composition, containing all dependency definitions that are found in rootdir or any of it's sub directories. Compositions are load from files that match the relative path cfgPath. Files that are in directories named as an element in ignoredDirs are ignored. CompositionFromDir calls *Composition.Verify() before it returns.

func CompositionFromJSON

func CompositionFromJSON(filePath string) (*Composition, error)

CompositionFromJSON loads a composition from the JSON file filePath. Afterwards it calls Composition.Verify.

func NewComposition

func NewComposition() *Composition

NewComposition creates an empty Composition.

func (*Composition) Add

func (c *Composition) Add(distribution, appName string, app *Dependencies)

func (*Composition) DependencyOrder

func (c *Composition) DependencyOrder(distribution string, apps ...string) ([]string, error)

DependencyOrder calculates the dependency order (reverse topological order) for the given distribution and returns it as string slice. The dependencies of an app, are ordered before the apps that depend on them. If a loop exist between hard dependencies an error is returned. If apps is not empty, the order is only calculated for the given app names instead of all. If an app name is not part of the distribution and error is returned.

func (*Composition) DependencyOrderDot

func (c *Composition) DependencyOrderDot(distribution string, apps ...string) (string, error)

DependencyOrder calculates the dependency order (reverse topological order) for the given distribution and returns it as graph in the dot format. Soft dependency are marked with dotted edges. If apps is not empty, the order is only calculated for the given app names instead of all. If an app name is not part of the distribution and error is returned. Different from DependencyOrder, not error is returned if a loop exist between hard dependencies, the loop shows up in the dot graph.

func (*Composition) IsEmpty

func (c *Composition) IsEmpty() bool

func (*Composition) ToJSON added in v3.2.0

func (c *Composition) ToJSON(w io.Writer) error

func (*Composition) ToJSONFile

func (c *Composition) ToJSONFile(path string) error

func (*Composition) Verify

func (c *Composition) Verify() error

Verify ensures that every soft- and hard dependency is also defined as app for a distribution.

type Dependencies

type Dependencies struct {
	SoftDeps []string `json:"soft_dependencies"`
	HardDeps []string `json:"hard_dependencies"`
}

Jump to

Keyboard shortcuts

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