versionbundle: github.com/giantswarm/versionbundle Index | Files

package versionbundle

import "github.com/giantswarm/versionbundle"

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

Index

Package Files

authority.go bundle.go bundles.go bundles_sort.go changelog.go collector.go component.go components_sort.go error.go index_release.go index_releases_sort.go release.go releases_sort.go version.go versionbundle.go

Constants

const (
    // KindAdded being used in a changelog describes an authority's component got
    // added.
    KindAdded kind = "added"
    // KindChanged being used in a changelog describes an authority's component got
    // changed.
    KindChanged kind = "changed"
    // KindDeprecated being used in a changelog describes an authority's component got
    // deprecated.
    KindDeprecated kind = "deprecated"
    // KindFixed being used in a changelog describes an authority's component got
    // fixed.
    KindFixed kind = "fixed"
    // KindRemoved being used in a changelog describes an authority's component got
    // removed.
    KindRemoved kind = "removed"
    // KindSecurity being used in a changelog describes an authority's component got
    // adapted for security reasons.
    KindSecurity kind = "security"
)

func IsBundleNotFound Uses

func IsBundleNotFound(err error) bool

IsBundleNotFound asserts bundleNotFoundError.

func IsExecutionFailed Uses

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidBundleError Uses

func IsInvalidBundleError(err error) bool

IsInvalidBundleError asserts invalidBundleError.

func IsInvalidBundlesError Uses

func IsInvalidBundlesError(err error) bool

IsInvalidBundlesError asserts invalidBundlesError.

func IsInvalidChangelog Uses

func IsInvalidChangelog(err error) bool

IsInvalidChangelog asserts invalidChangelogError.

func IsInvalidComponent Uses

func IsInvalidComponent(err error) bool

IsInvalidComponent asserts invalidComponentError.

func IsInvalidConfig Uses

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsInvalidRelease Uses

func IsInvalidRelease(err error) bool

IsInvalidRelease asserts invalidReleaseError.

func ValidateIndexReleases Uses

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.

type Authority Uses

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

func (Authority) BundleID Uses

func (a Authority) BundleID() string

type Bundle Uses

type Bundle struct {
    // Changelogs describe what changes are introduced by the version bundle. Each
    // version bundle must have at least one changelog entry.
    //
    // NOTE that once this property is set it must never change again.
    Changelogs []Changelog `json:"changelogs" yaml:"changelogs"`
    // 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 Uses

func CopyBundles(bundles []Bundle) []Bundle

func GetBundleByName Uses

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

func GetBundleByNameForProvider Uses

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

func GetNewestBundle Uses

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

func GetNewestBundleForProvider Uses

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

func (Bundle) ID Uses

func (b Bundle) ID() string

func (Bundle) IsMajorUpgrade Uses

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

func (Bundle) IsMinorUpgrade Uses

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

func (Bundle) IsPatchUpgrade Uses

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

func (Bundle) Validate Uses

func (b Bundle) Validate() error

type Bundles Uses

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 Uses

func (b Bundles) Contain(item Bundle) bool

func (Bundles) Validate Uses

func (b Bundles) Validate() error

type Changelog Uses

type Changelog struct {
    // Component is the component the changelog is about. Thus might be a
    // component provided by another authority. To be able to properly aggregate
    // version bundles the given component must exist, either within the same
    // authority or within another authority within the infrastructure. That is,
    // Aggregate must know about it to be able to properly merge version bundles.
    Component string `json:"component" yaml:"component"`
    // Description is some text describing the changelog entry. This information
    // is intended to be useful for humans.
    Description string `json:"description" yaml:"description"`
    // Kind is a machine readable type describing what kind of changelog the
    // changelog actually is. Also see the kind type.
    Kind kind `json:"kind" yaml:"kind"`
}

Changelog is a single changelog entry a version bundle must define. Its intention is to explain the introduction of the version bundle.

func CopyChangelogs Uses

func CopyChangelogs(changelogs []Changelog) []Changelog

func (Changelog) String Uses

func (c Changelog) String() string

func (Changelog) Validate Uses

func (c Changelog) Validate() error

type Collector Uses

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

func NewCollector Uses

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

func (*Collector) Bundles Uses

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

func (*Collector) Collect Uses

func (c *Collector) Collect(ctx context.Context) error

type CollectorConfig Uses

type CollectorConfig struct {
    FilterFunc func(Bundle) bool
    Logger     micrologger.Logger
    RestClient *resty.Client

    Endpoints []*url.URL
}

type CollectorEndpointResponse Uses

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

type Component Uses

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 Uses

func CopyComponents(components []Component) []Component

func (Component) Validate Uses

func (c Component) Validate() error

type IndexRelease Uses

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

type Release Uses

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

func CompileReleases Uses

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 Uses

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

func NewRelease Uses

func NewRelease(config ReleaseConfig) (Release, error)

func (Release) Active Uses

func (r Release) Active() bool

func (Release) Bundles Uses

func (r Release) Bundles() []Bundle

func (Release) Changelogs Uses

func (r Release) Changelogs() []Changelog

func (Release) Components Uses

func (r Release) Components() []Component

func (Release) Timestamp Uses

func (r Release) Timestamp() string

func (Release) Version Uses

func (r Release) Version() string

type ReleaseConfig Uses

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

type SortBundlesByName Uses

type SortBundlesByName []Bundle

func (SortBundlesByName) Len Uses

func (b SortBundlesByName) Len() int

func (SortBundlesByName) Less Uses

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

func (SortBundlesByName) Swap Uses

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

type SortBundlesByVersion Uses

type SortBundlesByVersion []Bundle

func (SortBundlesByVersion) Len Uses

func (b SortBundlesByVersion) Len() int

func (SortBundlesByVersion) Less Uses

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

func (SortBundlesByVersion) Swap Uses

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

type SortComponentsByName Uses

type SortComponentsByName []Component

func (SortComponentsByName) Len Uses

func (c SortComponentsByName) Len() int

func (SortComponentsByName) Less Uses

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

func (SortComponentsByName) Swap Uses

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

type SortIndexReleasesByVersion Uses

type SortIndexReleasesByVersion []IndexRelease

func (SortIndexReleasesByVersion) Len Uses

func (r SortIndexReleasesByVersion) Len() int

func (SortIndexReleasesByVersion) Less Uses

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

func (SortIndexReleasesByVersion) Swap Uses

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

type SortReleasesByTimestamp Uses

type SortReleasesByTimestamp []Release

func (SortReleasesByTimestamp) Len Uses

func (r SortReleasesByTimestamp) Len() int

func (SortReleasesByTimestamp) Less Uses

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

func (SortReleasesByTimestamp) Swap Uses

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

type SortReleasesByVersion Uses

type SortReleasesByVersion []Release

func (SortReleasesByVersion) Len Uses

func (r SortReleasesByVersion) Len() int

func (SortReleasesByVersion) Less Uses

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

func (SortReleasesByVersion) Swap Uses

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

type URL Uses

type URL struct {
    *url.URL
}

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

func (*URL) UnmarshalYAML Uses

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

Package versionbundle imports 17 packages (graph) and is imported by 52 packages. Updated 2019-04-25. Refresh now. Tools for package owners.