pkg

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown tristate = iota
	Present
	Absent
)

Variables

This section is empty.

Functions

func CreateBaseFingerPrint

func CreateBaseFingerPrint(releaseName, ns, chartName string) string

CreateBaseFingerPrint returns a base fingerprint

func CreateFingerPrint

func CreateFingerPrint(releaseName, version, ns, chartName string) string

CreateFingerPrint creates a fingerprint from the specific strings.

Types

type Pkg

type Pkg struct {
	// unique key:
	ReleaseName string // Release name, or default chart release-name
	Version     string // sem ver (without a range)
	Namespace   string // Installed ns, or default chart namespace
	ChartName   string // chart name

	DependsRel         []*PkgRel // list of dependencies' fingerprints
	DependsOptionalRel []*PkgRel // list of optional dependencies' fingerprints
	Repository         string    // repository where to find ChartName
	ParentChartPath    string    // Absolute path of parent chart, if existing
	CurrentState       tristate  // current state of the package
	DesiredState       tristate  // desired state of the package
	PinnedVer          tristate  // if we have a pinnedVer or not in pkg.Version
}

Pkg is the minimum object the solver reasons about. Note that each package is unique. The same chart, with the same default release name & ns, but different version, is a different package. E.g: prometheus-1.2.0 and prometheus-1.3.0 are different packages.

func NewPkg

func NewPkg(relName, chartName, version, namespace string,
	currentState, desiredState, pinnedVer tristate,
	repo, parentChartPath string) *Pkg

NewPkg creates a new Pkg struct. It does not give value to DependsRel, DependsOptionalRel.

func NewPkgMock

func NewPkgMock(name, version, namespace string,
	depends, dependsOptional []*PkgRel,
	currentState, desiredState tristate) *Pkg

NewPkgMock creates a new package. Useful for testing.

func (*Pkg) Encode

func (p *Pkg) Encode() (string, error)

Encode encodes the package to string in a JSON.

func (*Pkg) GetBaseFingerPrint

func (p *Pkg) GetBaseFingerPrint() string

GetBaseFingerPrint returns a unique id of the package minus version. This helps when filtering packages to find those that are similar and differ only in the version.

func (*Pkg) GetFingerPrint

func (p *Pkg) GetFingerPrint() string

GetFingerPrint returns a unique id of the package.

func (*Pkg) JSON

func (p *Pkg) JSON() ([]byte, error)

JSON serializes package p into JSON, returning a []byte

func (*Pkg) String

func (p *Pkg) String() (retString string)

String returns a string of some of the Pkg fields. Useful for debug output.

type PkgRel

type PkgRel struct {
	// unique key for base fingerprint:
	ReleaseName string
	Namespace   string
	SemverRange string // e.g: 1.0.0, ~1.0.0, ^1.0.0
	ChartName   string
}

PkgRel codifies a shared dependency relation to another package

Jump to

Keyboard shortcuts

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