versionfetch

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package versionfetch provides concurrent helpers for checking the latest versions of installed agents against their package registries.

Index

Constants

View Source
const DefaultConcurrency = 8

DefaultConcurrency is the default number of parallel version-check workers.

Variables

This section is empty.

Functions

func CheckLatestVersions

func CheckLatestVersions(
	ctx context.Context,
	fetcher LatestVersionFetcher,
	installations []*agent.Installation,
	agentDefs map[string]catalog.AgentDef,
	concurrency int,
) []error

CheckLatestVersions fills installations[i].LatestVersion concurrently by consulting the registry-appropriate provider via fetcher.GetLatestVersion.

The returned errors slice is parallel to installations: errs[i] holds the error (if any) encountered for installations[i]. Installations without a matching agent definition or install method are skipped (nil entry).

If concurrency <= 0, DefaultConcurrency is used.

Results are written back into installations by index, so the caller's slice retains stable ordering and there are no data races on the slice header.

func NonNilErrors

func NonNilErrors(errs []error) []error

NonNilErrors filters the parallel error slice returned by CheckLatestVersions to just the entries that actually failed. Preserves order.

Types

type LatestVersionFetcher

type LatestVersionFetcher interface {
	GetLatestVersion(ctx context.Context, method catalog.InstallMethodDef) (agent.Version, error)
}

LatestVersionFetcher is the subset of installer.Manager used by CheckLatestVersions. Accepting an interface keeps the helper decoupled from the concrete manager and makes it straightforward to unit test.

Jump to

Keyboard shortcuts

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