Documentation ¶
Index ¶
- func ErrConstraint(name string, version *semver.Version, constraint *semver.Constraints, ...) error
- func ErrDependency(name, dep string, cause error) error
- func ErrNotInstalled(name string) error
- type ConstraintError
- type DependencyError
- type DependencyGraph
- func (g *DependencyGraph) Add(name, version string, dependencies []v1alpha1.Dependency, manual bool) error
- func (g *DependencyGraph) Constraints(of string) []*semver.Constraints
- func (oldGraph *DependencyGraph) DeepCopy() *DependencyGraph
- func (g *DependencyGraph) Delete(name string) bool
- func (g *DependencyGraph) DeleteAndPrune(name string) []string
- func (g *DependencyGraph) Dependants(of string) []string
- func (g *DependencyGraph) Dependencies(of string) []string
- func (g *DependencyGraph) Manual(name string) bool
- func (g *DependencyGraph) Max(of string, versions []*semver.Version) (*semver.Version, error)
- func (g *DependencyGraph) Prune() []string
- func (g *DependencyGraph) Validate() error
- func (g *DependencyGraph) ValidateDelete(name string) ([]string, error)
- func (g *DependencyGraph) Version(of string) *semver.Version
- type NotInstalledError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrConstraint ¶
func ErrDependency ¶
func ErrNotInstalled ¶
Types ¶
type ConstraintError ¶
type ConstraintError struct { Name string Version *semver.Version Constraint *semver.Constraints // contains filtered or unexported fields }
ConstraintError indicates that a constraint has been violated
func (*ConstraintError) Error ¶
func (err *ConstraintError) Error() string
type DependencyError ¶
type DependencyError struct {
Name, Dependency string
// contains filtered or unexported fields
}
DependencyError idicates that a dependency is not met
func (*DependencyError) Error ¶
func (err *DependencyError) Error() string
func (*DependencyError) Is ¶
func (err *DependencyError) Is(other error) bool
func (*DependencyError) Unwrap ¶
func (err *DependencyError) Unwrap() error
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
func NewGraph ¶
func NewGraph() *DependencyGraph
func (*DependencyGraph) Add ¶
func (g *DependencyGraph) Add(name, version string, dependencies []v1alpha1.Dependency, manual bool) error
Add simulates installing or updating a package by 1. Creating a vertex if necessary 2. Setting its version and 3. Updating the outgoing edges of the vertex to match the manifests dependencies declaration
func (*DependencyGraph) Constraints ¶
func (g *DependencyGraph) Constraints(of string) []*semver.Constraints
Constraints returns all constraints of dependants of this package
func (*DependencyGraph) DeepCopy ¶
func (oldGraph *DependencyGraph) DeepCopy() *DependencyGraph
DeepCopy returns an exact copy of this graph
func (*DependencyGraph) Delete ¶
func (g *DependencyGraph) Delete(name string) bool
Delete simulates uninstalling a package.
The vertex is not actually removed from the graph, as it may still be referenced by other packages and needs to be kept for validation! Instead, its version is unset and its dependencies are cleared.
func (*DependencyGraph) DeleteAndPrune ¶
func (g *DependencyGraph) DeleteAndPrune(name string) []string
func (*DependencyGraph) Dependants ¶
func (g *DependencyGraph) Dependants(of string) []string
Dependants returns the names of packages that depend on this package
func (*DependencyGraph) Dependencies ¶
func (g *DependencyGraph) Dependencies(of string) []string
Dependencies returns the names of packages that this package depends on
func (*DependencyGraph) Manual ¶
func (g *DependencyGraph) Manual(name string) bool
Manual returns whether a package has been manually added by a user
func (*DependencyGraph) Max ¶
func (g *DependencyGraph) Max(of string, versions []*semver.Version) (*semver.Version, error)
Max returns the maximum element of versions that does not violate any constraint of this package
func (*DependencyGraph) Prune ¶
func (g *DependencyGraph) Prune() []string
Prune deletes all vertices for which all of the following applies: 1. It has not been installed manually 2. It does not have any dependants
func (*DependencyGraph) Validate ¶
func (g *DependencyGraph) Validate() error
Validate checks the consistency of the entire graph by checking that 1. All vertices with at least one dependency have a version that is not nil 2. There are no violated version constraints
func (*DependencyGraph) ValidateDelete ¶
func (g *DependencyGraph) ValidateDelete(name string) ([]string, error)
func (*DependencyGraph) Version ¶
func (g *DependencyGraph) Version(of string) *semver.Version
Version returns the installed version of a package or nil if that package is not installed
type NotInstalledError ¶
type NotInstalledError string
NotInstalledError indicates that a package is missing
func (*NotInstalledError) Error ¶
func (err *NotInstalledError) Error() string