solver

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package solver contains routines to build graph of pkg.yaml files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildkitFrontendLoader

type BuildkitFrontendLoader struct {
	*log.Logger
	Context types.Variables
	Ref     client.Reference
	//nolint:containedctx
	Ctx context.Context
	// contains filtered or unexported fields
}

BuildkitFrontendLoader loads packages from buildkit client.Reference.

func (*BuildkitFrontendLoader) Load

func (bkfl *BuildkitFrontendLoader) Load() (*LoadResult, error)

Load implements PackageLoader.

type FilesystemPackageLoader

type FilesystemPackageLoader struct {
	*log.Logger
	Context types.Variables

	Root string
	// contains filtered or unexported fields
}

FilesystemPackageLoader loads packages by walking file system tree.

func (*FilesystemPackageLoader) Load

func (fspl *FilesystemPackageLoader) Load() (*LoadResult, error)

Load implements PackageLoader.

type LoadResult

type LoadResult struct {
	Pkgfile *v1alpha2.Pkgfile
	Pkgs    []*v1alpha2.Pkg
}

LoadResult is a result of PackageLoader.Load function.

type PackageDependency

type PackageDependency struct {
	// Pkg is set only for Internal dependencies.
	Node *PackageNode
	v1alpha2.Dependency
}

PackageDependency wraps v1alpha2.Depency with resolved internal dependencies.

func (PackageDependency) ID

func (dep PackageDependency) ID() string

ID returns unique string for dependency.

type PackageGraph

type PackageGraph struct {
	Root *PackageNode
}

PackageGraph capture root of the DAG.

func (*PackageGraph) ToSet

func (graph *PackageGraph) ToSet() PackageSet

ToSet converts graph to set of nodes.

type PackageLoader

type PackageLoader interface {
	Load() (*LoadResult, error)
}

PackageLoader implements some way to fetch collection of Pkgs.

type PackageNode

type PackageNode struct {
	Pkg          *v1alpha2.Pkg
	Name         string
	Dependencies []PackageDependency
}

PackageNode is a Pkg with associated dependencies.

func (*PackageNode) DumpDot

func (node *PackageNode) DumpDot(g *dot.Graph) dot.Node

DumpDot dumps node and dependencies.

func (*PackageNode) RuntimeDependencies

func (node *PackageNode) RuntimeDependencies() (deps []PackageDependency)

RuntimeDependencies returns (recursively) all the runtime dependencies for the package.

type PackageSet

type PackageSet []*PackageNode

PackageSet is a list of PackageNodes.

func (PackageSet) DumpDot

func (set PackageSet) DumpDot(w io.Writer)

DumpDot dumps nodes and deps in dot format.

type Packages

type Packages struct {
	// contains filtered or unexported fields
}

Packages is a collect of Pkg objects with dependencies tracked.

func NewPackages

func NewPackages(loader PackageLoader) (*Packages, error)

NewPackages builds Packages using PackageLoader.

func (*Packages) ImageLabels

func (pkgs *Packages) ImageLabels() map[string]string

ImageLabels returns set of image labels to apply to the output image.

func (*Packages) Resolve

func (pkgs *Packages) Resolve(target string) (*PackageGraph, error)

Resolve trims down the package tree to have only deps of the target.

func (*Packages) ToSet

func (pkgs *Packages) ToSet() (set PackageSet)

ToSet converts to set of package nodes.

Jump to

Keyboard shortcuts

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