upgrade

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	// MinorUpdate contains the latest minor upgrade if exists.
	MinorUpdate *ClickHouseVersion
	// MajorUpdates contains latest minor upgrades from each major release after current. Within selected channel.
	MajorUpdates []ClickHouseVersion
	// Outdated is true if current release is out of support.
	Outdated bool
	// OnChannel is true if current release belongs to selected channel.
	OnChannel bool
}

CheckResult represents the result of checking for updates.

type Checker

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

Checker is responsible for checking for available upgrades.

func NewChecker

func NewChecker(updater *ReleaseUpdater) *Checker

NewChecker creates a new Checker.

func (*Checker) CheckUpdates

func (t *Checker) CheckUpdates(currentRaw string, channel string) (CheckResult, error)

CheckUpdates returns a list of ClickHouse versions that are newer than the current version and belong to the specified channel.

type ClickHouseRelease

type ClickHouseRelease struct {
	Major int32
	Minor int32
}

ClickHouseRelease represents a ClickHouse release, identified by its year and month of release (e.g. 26.1).

type ClickHouseVersion

type ClickHouseVersion struct {
	// Major is release year (the first component of the version string).
	Major int32
	// Minor is the release month within the year (the second component of the version string).
	Minor int32
	// Patch is the patch version number (the third component of the version string).
	Patch int32
	// Build is the build number (the fourth component of the version string, optional).
	Build int32
}

ClickHouseVersion represents a ClickHouse version.

func ParseBareVersion

func ParseBareVersion(raw string) (ClickHouseVersion, error)

ParseBareVersion parses a bare numeric version string (e.g. "25.8.2.1") without a channel suffix. This is used for version strings returned by the version probe.

func ParseVersion

func ParseVersion(raw string) (ClickHouseVersion, string, error)

ParseVersion parses a raw version string into a ClickHouseVersion struct.

func (ClickHouseVersion) Release

func (ch ClickHouseVersion) Release() ClickHouseRelease

Release returns the ClickHouseRelease corresponding to the major and minor version of the ClickHouseVersion.

func (ClickHouseVersion) Version

func (ch ClickHouseVersion) Version() string

Version returns the string representation of the ClickHouse version.

type Fetcher

type Fetcher interface {
	FetchReleases(ctx context.Context) (map[string][]ClickHouseVersion, error)
}

Fetcher is an interface for fetching ClickHouse releases from a source.

type ReleaseData

type ReleaseData struct {
	// Releases maps channel to a map from release to the latest minor version.
	Releases releaseMap
	// Supported contains the map of supported major releases.
	Supported map[ClickHouseRelease]bool
}

ReleaseData contains preprocessed release data: all versions by channel and supported releases.

type ReleaseUpdater

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

ReleaseUpdater periodically fetches and updates ClickHouse release data, maintaining a cache of the latest preprocessed information.

func NewReleaseUpdater

func NewReleaseUpdater(fetcher Fetcher, interval time.Duration, log controllerutil.Logger) *ReleaseUpdater

NewReleaseUpdater creates a new ReleaseUpdater.

func (*ReleaseUpdater) GetReleasesData

func (u *ReleaseUpdater) GetReleasesData() *ReleaseData

GetReleasesData returns the latest cached release data. It may return nil if no data has been fetched yet.

func (*ReleaseUpdater) Start

func (u *ReleaseUpdater) Start(ctx context.Context) error

Start the release updater loop, which periodically fetches and updates release data. Blocks until the context is canceled. It implements the manager.Runnable interface.

type StaticFetcher

type StaticFetcher struct {
	Releases map[string][]ClickHouseVersion
}

StaticFetcher is a simple implementation of Fetcher that returns a predefined list of releases. Used for testing.

func (*StaticFetcher) FetchReleases

func (s *StaticFetcher) FetchReleases(context.Context) (map[string][]ClickHouseVersion, error)

FetchReleases returns the predefined list of releases.

type URLFetcher

type URLFetcher struct {
	RequestTimeout time.Duration
	HTTPClient     *http.Client
	VersionsURL    string
}

URLFetcher is an implementation of Fetcher that fetches ClickHouse releases from a URL in TSV format.

func NewURLFetcher

func NewURLFetcher() *URLFetcher

NewURLFetcher creates a new URLFetcher.

func (*URLFetcher) FetchReleases

func (f *URLFetcher) FetchReleases(ctx context.Context) (map[string][]ClickHouseVersion, error)

FetchReleases queries the list of ClickHouse releases.

Jump to

Keyboard shortcuts

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