versionbundle

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 16 Imported by: 98

README

CircleCI

versionbundle

Package versionbundle provides primitives for dynamic and recursive version management within infrastructures of distributed microservices.

Documentation

Overview

Package versionbundle provides primitives for dynamic and recursive version management within infrastructures of distributed microservices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBundleNotFound

func IsBundleNotFound(err error) bool

IsBundleNotFound asserts bundleNotFoundError.

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidBundle added in v0.2.0

func IsInvalidBundle(err error) bool

IsInvalidBundle asserts invalidBundleError.

func IsInvalidBundleError

func IsInvalidBundleError(err error) bool

IsInvalidBundleError asserts invalidBundleError.

func IsInvalidBundles added in v0.2.0

func IsInvalidBundles(err error) bool

IsInvalidBundles asserts invalidBundlesError.

func IsInvalidBundlesError

func IsInvalidBundlesError(err error) bool

IsInvalidBundlesError asserts invalidBundlesError.

func IsInvalidChangelog

func IsInvalidChangelog(err error) bool

IsInvalidChangelog asserts invalidChangelogError.

func IsInvalidComponent

func IsInvalidComponent(err error) bool

IsInvalidComponent asserts invalidComponentError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsInvalidRelease

func IsInvalidRelease(err error) bool

IsInvalidRelease asserts invalidReleaseError.

func ValidateIndexReleases

func ValidateIndexReleases(indexReleases []IndexRelease) error

ValidateIndexReleases ensures semantic rules for collection of indexReleases so that when used together, they form consistent and integral release index.

Types

type App

type App struct {
	App              string `yaml:"app"`
	ComponentVersion string `yaml:"componentVersion"`
	Version          string `yaml:"version"`
}

func CopyApps

func CopyApps(apps []App) []App

func (App) AppID

func (a App) AppID() string

type Authority

type Authority struct {
	Name     string `yaml:"name"`
	Provider string `yaml:"provider"`
	Version  string `yaml:"version"`
}

func (Authority) BundleID

func (a Authority) BundleID() string

type Bundle

type Bundle struct {
	// Components describe the components an authority exposes. Functionality of
	// components listed here is guaranteed to be implemented in the according
	// versions.
	//
	// NOTE that once this property is set it must never change again.
	Components []Component `json:"components" yaml:"components"`
	// Name is the name of the authority exposing the version bundle.
	//
	// NOTE that once this property is set it must never change again.
	Name string `json:"name" yaml:"name"`
	// Provider describes infrastructure provider that is specific for this
	// Bundle.
	Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
	// Version describes the version of the version bundle. Versions of version
	// bundles must be semver versions. Versions must not be duplicated. Versions
	// should be incremented gradually.
	//
	// NOTE that once this property is set it must never change again.
	Version string `json:"version" yaml:"version"`
}

Bundle represents a single version bundle exposed by an authority. An authority might exposes mutliple version bundles using the Capability structure. Version bundles are aggregated into a merged structure represented by the Aggregation structure. Also see the Aggregate function.

func CopyBundles

func CopyBundles(bundles []Bundle) []Bundle

func GetBundleByName

func GetBundleByName(bundles []Bundle, name string) (Bundle, error)

func GetBundleByNameForProvider

func GetBundleByNameForProvider(bundles []Bundle, name, provider string) (Bundle, error)

func GetNewestBundle

func GetNewestBundle(bundles []Bundle) (Bundle, error)

func GetNewestBundleForProvider

func GetNewestBundleForProvider(bundles []Bundle, provider string) (Bundle, error)

func (Bundle) ID

func (b Bundle) ID() string

func (Bundle) IsMajorUpgrade

func (b Bundle) IsMajorUpgrade(other Bundle) (bool, error)

func (Bundle) IsMinorUpgrade

func (b Bundle) IsMinorUpgrade(other Bundle) (bool, error)

func (Bundle) IsPatchUpgrade

func (b Bundle) IsPatchUpgrade(other Bundle) (bool, error)

func (Bundle) Validate

func (b Bundle) Validate() error

type Bundles

type Bundles []Bundle

Bundles is a plain validation type for a list of version bundles. A list of version bundles is exposed by authorities. Lists of version bundles of multiple authorities are aggregated and grouped to reflect releases.

func (Bundles) Contain

func (b Bundles) Contain(item Bundle) bool

func (Bundles) Validate

func (b Bundles) Validate() error

type Collector

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

func NewCollector

func NewCollector(config CollectorConfig) (*Collector, error)

func (*Collector) Bundles

func (c *Collector) Bundles() []Bundle

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context, endpoints []*url.URL) error

type CollectorConfig

type CollectorConfig struct {
	// FilterFunc is not required and therefore not validated within the
	// constructor below.
	FilterFunc func(Bundle) bool
	Logger     micrologger.Logger
	RestClient *resty.Client
}

type CollectorEndpointResponse

type CollectorEndpointResponse struct {
	VersionBundles []Bundle `json:"version_bundles"`
}

type Component

type Component struct {
	// Name is the name of the exposed component.
	Name string `json:"name" yaml:"name"`
	// Version is the version of the exposed component.
	Version string `json:"version" yaml:"version"`
}

Component is the software component an authority provides. It describes the functionality of such a component being exposed by the authority. In return an authority guarantees to provide the components functionality.

func CopyComponents

func CopyComponents(components []Component) []Component

func (Component) Validate

func (c Component) Validate() error

type IndexRelease

type IndexRelease struct {
	Active      bool        `yaml:"active"`
	Apps        []App       `yaml:"apps"`
	Authorities []Authority `yaml:"authorities"`
	Date        time.Time   `yaml:"date"`
	Version     string      `yaml:"version"`
}

type Release

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

func CompileReleases

func CompileReleases(logger micrologger.Logger, indexReleases []IndexRelease, bundles []Bundle) ([]Release, error)

CompileReleases takes indexReleases and collected version bundles and compiles canonicalized Releases from them.

func GetNewestRelease

func GetNewestRelease(releases []Release) (Release, error)

func NewRelease

func NewRelease(config ReleaseConfig) (Release, error)

func (Release) Active

func (r Release) Active() bool

func (Release) Apps

func (r Release) Apps() []App

func (Release) Bundles

func (r Release) Bundles() []Bundle

func (Release) Components

func (r Release) Components() []Component

func (Release) Timestamp

func (r Release) Timestamp() string

func (Release) Version

func (r Release) Version() string

type ReleaseConfig

type ReleaseConfig struct {
	Active  bool
	Apps    []App
	Bundles []Bundle
	Date    time.Time
	Version string
}

type SortBundlesByName

type SortBundlesByName []Bundle

func (SortBundlesByName) Len

func (b SortBundlesByName) Len() int

func (SortBundlesByName) Less

func (b SortBundlesByName) Less(i, j int) bool

func (SortBundlesByName) Swap

func (b SortBundlesByName) Swap(i, j int)

type SortBundlesByVersion

type SortBundlesByVersion []Bundle

func (SortBundlesByVersion) Len

func (b SortBundlesByVersion) Len() int

func (SortBundlesByVersion) Less

func (b SortBundlesByVersion) Less(i, j int) bool

func (SortBundlesByVersion) Swap

func (b SortBundlesByVersion) Swap(i, j int)

type SortComponentsByName

type SortComponentsByName []Component

func (SortComponentsByName) Len

func (c SortComponentsByName) Len() int

func (SortComponentsByName) Less

func (c SortComponentsByName) Less(i, j int) bool

func (SortComponentsByName) Swap

func (c SortComponentsByName) Swap(i, j int)

type SortIndexReleasesByVersion

type SortIndexReleasesByVersion []IndexRelease

func (SortIndexReleasesByVersion) Len

func (SortIndexReleasesByVersion) Less

func (r SortIndexReleasesByVersion) Less(i, j int) bool

func (SortIndexReleasesByVersion) Swap

func (r SortIndexReleasesByVersion) Swap(i, j int)

type SortReleasesByTimestamp

type SortReleasesByTimestamp []Release

func (SortReleasesByTimestamp) Len

func (r SortReleasesByTimestamp) Len() int

func (SortReleasesByTimestamp) Less

func (r SortReleasesByTimestamp) Less(i, j int) bool

func (SortReleasesByTimestamp) Swap

func (r SortReleasesByTimestamp) Swap(i, j int)

type SortReleasesByVersion

type SortReleasesByVersion []Release

func (SortReleasesByVersion) Len

func (r SortReleasesByVersion) Len() int

func (SortReleasesByVersion) Less

func (r SortReleasesByVersion) Less(i, j int) bool

func (SortReleasesByVersion) Swap

func (r SortReleasesByVersion) Swap(i, j int)

type URL

type URL struct {
	*url.URL
}

URL is a hack referring to the native url.URL in order to support yaml unmarshaling.

func (*URL) UnmarshalYAML

func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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