Documentation ¶
Index ¶
- Constants
- func FindTargetVersion(availableVersions []string, currentVersion string, target UpgradeTarget) (string, error)
- func FormatGroups(groups []string) string
- func FormatStringList(strs []string, empty string) string
- func FormatVariants(variants []string) string
- type App
- type Catalog
- type Client
- type ClientState
- type Criticality
- type Filter
- type Group
- type GroupFilter
- type NextSpec
- type Numbering
- type Release
- type ReleaseHistory
- type StoreInterface
- type TargetSpec
- type UpgradeInfo
- type UpgradePath
- type UpgradeStep
- type UpgradeTarget
- type Variant
- type VariantFilter
- type VersionInfo
Constants ¶
View Source
const ( AnyNumber Numbering = "" EvenNumbers = "e" OddNumbers = "o" )
View Source
const ( // DefaultUpgradeTarget means: Upgrade to the latest minor+patch of the current major, then use the first minor of the next major DefaultUpgradeTarget UpgradeTarget = "#.+.*;+._.*" AlwaysLatest = "*.*.*" // Useful for uncritical, possibly stateless software OnlyMinorAndPatches = "#.*.*" // Useful for end-of-life versions OnlyPatches = "#.#.*" // Useful for ensuring highest compatibility )
Variables ¶
This section is empty.
Functions ¶
func FindTargetVersion ¶
func FindTargetVersion(availableVersions []string, currentVersion string, target UpgradeTarget) (string, error)
func FormatGroups ¶
func FormatStringList ¶
func FormatVariants ¶
Types ¶
type App ¶
type App struct { Vendor string // must be present and match a client's installation Product string // must be present and match a client's installation Name string // for printing; if not given, "<vendor> <product>" will be used Active bool // if this app is "delivered" or "handled" at all Locked bool // if updates of this app are "delivered" at all AllowRegister bool // if clients are allowed to register UpgradeTarget UpgradeTarget // If empty, the default upgrade target will be used Created time.Time Updated time.Time Groups []string DefaultGroups []string // empty means "public" by default Variants []string }
type Catalog ¶
type Catalog interface { RegisterClient(vendor string, product string, variant string) (*ClientState, error) ShouldUpgrade(state *ClientState) (Criticality, error) // FindNextUpgrade should return nil if no update is available FindNextUpgrade(state *ClientState) (*UpgradeStep, error) // FindUpgradePath should return nil if no update is available FindUpgradePath(state *ClientState) (*UpgradePath, error) }
Catalog is the user-facing service (definition) of the server part
type ClientState ¶
type ClientState struct { ClientId string Vendor string Product string Variant string // optional OS string // optional, e.g. for jars Arch string // optional CurrentVersion string WithUnstable bool }
func (ClientState) IsInstalled ¶
func (state ClientState) IsInstalled() bool
func (ClientState) IsValid ¶
func (state ClientState) IsValid() bool
func (ClientState) ToFilter ¶
func (state ClientState) ToFilter() Filter
type Criticality ¶
type Criticality int
const ( None Criticality = 0 Possible Criticality = 1 Recommended Criticality = 2 StronglyRecommended Criticality = 3 Critical Criticality = 4 Enforced Criticality = 5 Exceptional Criticality = -1 // manual interception necessary )
func CriticalityFromString ¶
func CriticalityFromString(value string) (Criticality, error)
func (Criticality) String ¶
func (c Criticality) String() string
type Filter ¶
type Filter struct { Vendor string Product string Name string Variant string EnforceVariant bool // if an empty variant will be matched OS string Arch string Alias string MinVersion string // use MinVersion == MaxVersion to hit an exact version MaxVersion string AfterVersion string // like a "MinVersion" but excluding this version BeforeVersion string // like a "MaxVersion" but excluding this version WithUnstable bool Groups []string }
func (*Filter) CompleteVersions ¶
func (f *Filter) CompleteVersions()
func (*Filter) FiltersVersions ¶
func (*Filter) MatchVersion ¶
type GroupFilter ¶
type Release ¶
type Release struct { App *App Variant string // sth like "Pro" or "Light" (if given it must match a client's installation) Description string OS string // sth like "MacOS", "darwin" or "linux"; if given it must match a client's installation Arch string // sth like "i386 or "ppc64"; if given it must match a client's installation Date time.Time Version string // for use with semantic versioning Unstable bool // some clients may not want to use unstable versions Alias string // sth like "Focal Fossa"; optional, for printing (and release management) only Link string // Some URL or whatever the installer should be pointed to Format string // The package format might change over time. Use format to handle these generations Signature string // a cryptographical representation (hash etc) Tags []string UpgradeTarget UpgradeTarget // If empty, the default upgrade target will be used ShouldUpgrade Criticality Groups []string }
type ReleaseHistory ¶
type StoreInterface ¶
type StoreInterface interface { // App management ListApps(limit int) ([]*App, error) StoreApp(app *App, allowUpdate bool) (*App, error) FindApp(vendor string, product string) (*App, error) SetAppDefaultGroups(app *App) (*App, error) // Group management ListGroups(filter GroupFilter, limit int) ([]*Group, error) StoreGroup(group *Group, allowUpdate bool) (*Group, error) // Client management RegisterClient(app *App, variant string, groups []string) (*Client, error) // Variant management ListVariants(filter VariantFilter, limit int) ([]*Variant, error) StoreVariant(variant *Variant, allowUpdate bool) (*Variant, error) // Release management StoreRelease(release *Release, allowUpdate bool) (*Release, error) FetchReleases(filter Filter, limit int) ([]*Release, error) SetCriticality(filter Filter, criticality Criticality) ([]*Release, error) SetStability(filter Filter, stability bool) ([]*Release, error) SetUpgradeTarget(filter Filter, target UpgradeTarget) ([]*Release, error) }
type TargetSpec ¶
type UpgradeInfo ¶
type UpgradePath ¶
type UpgradePath struct { Info UpgradeInfo Criticality Criticality Steps []UpgradeStep }
func FindUpgradePath ¶
func FindUpgradePath(availableReleases []*Release, currentVersion string) (*UpgradePath, error)
type UpgradeStep ¶
type UpgradeStep struct { Info UpgradeInfo Release Release Criticality Criticality }
func FindInstallVersion ¶
func FindInstallVersion(availableReleases []*Release, withUnstable bool) (*UpgradeStep, error)
FindInstallVersion retrieves the latest (stable) version
func FindNextUpgrade ¶
func FindNextUpgrade(availableReleases []*Release, currentVersion string) (*UpgradeStep, error)
func (*UpgradeStep) ToPath ¶
func (step *UpgradeStep) ToPath() *UpgradePath
type UpgradeTarget ¶
type UpgradeTarget string
UpgradeTarget defines the next logical version from a given, mostly current, semantic version
- Use a colon ";" to divide upgrade steps that must be run through sequentially
- Use a hashtag "#" to refer to the current number
- Use a star sign "*" to refer to the highest and latest available number
- A plus sign "+([1-9]|e|o|c)?" refers to the next available number. Using an optional step size will set the behaviour to skip (n-1) intermediate numbers (meaning current "7" out of a release history of [6,7,9,10] and "+2" will result in "10" as upgrade target). Use +e for the next even number and +o for the next odd number. Use +c for the next number that is even or odd depending on the current number.
- Use an underscore sign "_" to refer to the lowest available number.
- Use a number to refer to a specific version.
Examples: - "*.*.*" refers to the absolute latest version. - "#.#.*" refers to the latest patch version. - "+._.*" refers to the latest patch of the first minor version of the next major version. - "4.0.0" refers to 4.0.0 exactly
If no version is found matching the above spec, then at least the latest patch version is searched for. If you want to exclude that, add a "nopatches:" prefix to the upgrade target string, e.g. "nopatches:*.*.0"
func (UpgradeTarget) FirstTargetSpec ¶
func (target UpgradeTarget) FirstTargetSpec() (*TargetSpec, error)
func (UpgradeTarget) IsValid ¶
func (target UpgradeTarget) IsValid() bool
type Variant ¶
type Variant struct { App *App Name string Active bool // if this app variant is "delivered" or "handled" at all Locked bool // if updates of this app variant are "delivered" at all AllowRegister bool // if clients are allowed to register UpgradeTarget UpgradeTarget // If empty, the upgrade target of the app will be used Created time.Time Updated time.Time DefaultGroups []string // empty means "default groups of the app" here }
type VariantFilter ¶
Click to show internal directories.
Click to hide internal directories.