channel

package
v0.0.0-...-c7fba9c Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPinnedTrackSwitch = errors.New("cannot switch pinned track")

Functions

func Full

func Full(s string) (string, error)

func Resolve

func Resolve(channel, newChannel string) (string, error)

Resolve resolves newChannel wrt channel, this means if newChannel is risk/branch only it will preserve the track of channel. It assumes that if both are not empty, channel is parseable.

func ResolvePinned

func ResolvePinned(track, newChannel string) (string, error)

ResolvePinned resolves newChannel wrt a pinned track, newChannel can only be risk/branch-only or have the same track, otherwise ErrPinnedTrackSwitch is returned.

Types

type Channel

type Channel struct {
	Architecture string `json:"architecture"`
	Name         string `json:"name"`
	Track        string `json:"track"`
	Risk         string `json:"risk"`
	Branch       string `json:"branch,omitempty"`
}

Channel identifies and describes completely a store channel.

func Parse

func Parse(s string, architecture string) (Channel, error)

Parse parses a string representing a store channel and includes given architecture, , if architecture is "" the system architecture is included. The returned channel's track, risk and name are normalized.

func ParseVerbatim

func ParseVerbatim(s string, architecture string) (Channel, error)

ParseVerbatim parses a string representing a store channel and includes the given architecture, if architecture is "" the system architecture is included. The channel representation is not normalized. Parse() should be used in most cases.

func (Channel) Clean

func (c Channel) Clean() Channel

Clean returns a Channel with a normalized track, risk and name.

func (*Channel) Full

func (c *Channel) Full() string

Full returns the full name of the channel, inclusive the default track "latest".

func (*Channel) Match

func (c *Channel) Match(c1 *Channel) ChannelMatch

Match returns a ChannelMatch of which fields among architecture,track,risk match between c and c1 store channels, risk is matched taking channel inheritance into account and considering c the requested channel.

func (Channel) String

func (c Channel) String() string

func (*Channel) VerbatimRiskOnly

func (c *Channel) VerbatimRiskOnly() bool

VerbatimRiskOnly returns whether the channel represents a risk only.

func (*Channel) VerbatimTrackOnly

func (c *Channel) VerbatimTrackOnly() bool

VerbatimTrackOnly returns whether the channel represents a track only.

type ChannelMatch

type ChannelMatch struct {
	Architecture bool
	Track        bool
	Risk         bool
}

ChannelMatch represents on which fields two channels are matching.

func (ChannelMatch) String

func (cm ChannelMatch) String() string

String returns the string represantion of the match, results can be:

"architecture:track:risk"
"architecture:track"
"architecture:risk"
"track:risk"
"architecture"
"track"
"risk"
""

Jump to

Keyboard shortcuts

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