Documentation ¶
Index ¶
- type Composition
- func (c *Composition) Add(distribution, appName string, app *Dependencies)
- func (c *Composition) DependencyOrder(distribution string, apps ...string) ([]string, error)
- func (c *Composition) DependencyOrderDot(distribution string, apps ...string) (string, error)
- func (c *Composition) IsEmpty() bool
- func (c *Composition) ToJSON(w io.Writer) error
- func (c *Composition) ToJSONFile(path string) error
- func (c *Composition) Verify() error
- type Dependencies
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) 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.