catalog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DocsAnchor = "docs/catalog.md#schema-version"
View Source
const PackagesSubdir = "pkgs"

On-disk layout: <repoRoot>/<PackagesSubdir>/<name>/pkg.yaml.

View Source
const SupportedSchemaVersion = 1

Variables

View Source
var ErrPackageNotFound = errors.New("package not found in catalog")
View Source
var ErrUnsupportedSchemaVersion error = UnsupportedSchemaVersionError{}

Functions

This section is empty.

Types

type CopyAction

type CopyAction struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

type Entry

type Entry struct {
	Name   string
	Source Source
}

type ExtractAction

type ExtractAction struct {
	From string `yaml:"from"`
	As   string `yaml:"as,omitempty"`
}

type Git

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

func NewGit

func NewGit(localDir, remote, ref string, engine *fetcher.Engine, reporter Reporter) *Git

func (*Git) FetchArchive

func (a *Git) FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)

func (*Git) FetchSource

func (a *Git) FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)

func (*Git) Info

func (a *Git) Info(ctx context.Context, pkgName string) (*Package, error)

func (*Git) ListVersions

func (a *Git) ListVersions(ctx context.Context, pkgName string) ([]string, error)

func (*Git) Summaries added in v0.4.0

func (a *Git) Summaries(ctx context.Context) ([]Summary, error)

func (*Git) Update

func (a *Git) Update(ctx context.Context) error

type LocalDir

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

func NewLocalDir

func NewLocalDir(localDir string, engine *fetcher.Engine, reporter Reporter) *LocalDir

func (*LocalDir) FetchArchive

func (a *LocalDir) FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)

func (*LocalDir) FetchSource

func (a *LocalDir) FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)

func (*LocalDir) Info

func (a *LocalDir) Info(ctx context.Context, pkgName string) (*Package, error)

func (*LocalDir) ListVersions

func (a *LocalDir) ListVersions(ctx context.Context, pkgName string) ([]string, error)

func (*LocalDir) Summaries added in v0.4.0

func (a *LocalDir) Summaries(ctx context.Context) ([]Summary, error)

Summaries returns one Summary per package directory that holds a loadable pkg.yaml. A package whose pkg.yaml fails to load or validate is skipped with a warning, so one broken manifest does not blank the whole listing. A directory with no pkg.yaml is silently ignored.

type MkdirAction

type MkdirAction struct {
	Path string `yaml:"path"`
}

type Multi

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

func NewMulti

func NewMulti(entries []Entry, reporter Reporter) *Multi

func (*Multi) Latest

func (m *Multi) Latest(ctx context.Context, pkgName string) (string, Entry, error)

func (*Multi) Locate

func (m *Multi) Locate(ctx context.Context, pkgName string) (Entry, *Package, error)

func (*Multi) Search

func (m *Multi) Search(ctx context.Context, query string) []SearchResult

func (*Multi) UpdateAll

func (m *Multi) UpdateAll(ctx context.Context) []UpdateResult

func (*Multi) UpdateOne

func (m *Multi) UpdateOne(ctx context.Context, name string) error

func (*Multi) VersionsOf

func (m *Multi) VersionsOf(ctx context.Context, pkgName string) []VersionResult

type OCI added in v0.3.0

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

OCI is a catalog Source backed by an OCI registry: it mirrors the catalog image index at <base> into a local oras OCI-layout store, then reads each package's pkg.yaml from that mirror with verify-on-read. Archive/source blobs are not mirrored here; they stream through the fetcher.Engine.

func NewOCI added in v0.3.0

func NewOCI(cacheDir, configRef string, mirror *oci.Mirror, engine *fetcher.Engine, reporter Reporter) *OCI

NewOCI builds an OCI Source. configRef is "<base>[:<tag>][@<digest>]"; base and reference are split from it. mirror mirrors and serves catalog metadata; engine pulls archive/source blobs.

func (*OCI) FetchArchive added in v0.3.0

func (a *OCI) FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)

func (*OCI) FetchSource added in v0.3.0

func (a *OCI) FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)

func (*OCI) Info added in v0.3.0

func (a *OCI) Info(ctx context.Context, pkgName string) (*Package, error)

func (*OCI) ListVersions added in v0.3.0

func (a *OCI) ListVersions(ctx context.Context, pkgName string) ([]string, error)

func (*OCI) Summaries added in v0.4.0

func (a *OCI) Summaries(ctx context.Context) ([]Summary, error)

func (*OCI) Update added in v0.3.0

func (a *OCI) Update(ctx context.Context) error

Update re-mirrors the catalog graph and refreshes the in-memory index. It also removes any legacy custom-JSON cache (index.json + pkgs/). Sync + GC run under the process lock so two concurrent updates cannot race the store's tag map / GC.

type Package

type Package struct {
	SchemaVersion int      `yaml:"schemaVersion"`
	Name          string   `yaml:"name"`
	Description   string   `yaml:"description"`
	License       string   `yaml:"license"`
	Homepage      string   `yaml:"homepage"`
	DependsOn     []string `yaml:"dependsOn"`

	BuildFromSource bool `yaml:"buildFromSource"`

	Archive *fetcher.Artifact `yaml:"archive,omitempty"`
	Source  *fetcher.Artifact `yaml:"source,omitempty"`

	Versions []VersionEntry `yaml:"versions"`

	Build   []Step `yaml:"build,omitempty"`
	Install []Step `yaml:"install,omitempty"`
	Test    []Step `yaml:"test,omitempty"`
}

func LoadPackage added in v0.3.0

func LoadPackage(data []byte, origin string) (*Package, error)

LoadPackage unmarshals YAML and rejects unsupported schemaVersion values. Pass origin="" when the caller renders it separately (e.g. linter Finding.File).

func (*Package) Phases

func (p *Package) Phases() []PhaseSteps

func (*Package) Validate

func (p *Package) Validate() error

type Phase

type Phase string

Closed set; declarative.go and the linter iterate Phases() in order — keep in sync.

const (
	PhaseBuild   Phase = "build"
	PhaseInstall Phase = "install"
	PhaseTest    Phase = "test"
)

type PhaseSteps

type PhaseSteps struct {
	Name  Phase
	Steps []Step
}

type Reporter

type Reporter interface {
	Info(format string, args ...any)
	Warn(format string, args ...any)
}
var DiscardReporter Reporter = discardReporter{}

type RunAction

type RunAction struct {
	Cmd []string `yaml:"cmd"`
	Cwd string   `yaml:"cwd,omitempty"`
}

type SearchResult

type SearchResult struct {
	Catalog     string
	Name        string
	Description string
}

type Source

type Source interface {
	Summaries(ctx context.Context) ([]Summary, error)
	ListVersions(ctx context.Context, pkgName string) ([]string, error)
	Info(ctx context.Context, pkgName string) (*Package, error)
	FetchArchive(ctx context.Context, name, version string, platform fetcher.Platform) (io.ReadCloser, int64, error)
	FetchSource(ctx context.Context, name, version string) (io.ReadCloser, int64, error)
}

type Step

type Step struct {
	Extract *ExtractAction `yaml:"extract,omitempty"`
	Copy    *CopyAction    `yaml:"copy,omitempty"`
	Mkdir   *MkdirAction   `yaml:"mkdir,omitempty"`
	Run     *RunAction     `yaml:"run,omitempty"`
}

func (Step) Validate

func (s Step) Validate(phase Phase) error

type Summary added in v0.4.0

type Summary struct {
	Name        string
	Description string
}

Summary is the lightweight per-package metadata used by search and completion: enough to display and match without fetching a full Package.

func Search(ctx context.Context, r Source, query string) ([]Summary, error)

Search returns the summaries whose name or description contains query (case-insensitive). An empty query matches everything.

type UnsupportedSchemaVersionError added in v0.3.0

type UnsupportedSchemaVersionError struct {
	Origin string
	Got    int
	Want   int
}

Origin is generic so OCI registry coordinates can ride the same field.

func (UnsupportedSchemaVersionError) Error added in v0.3.0

func (UnsupportedSchemaVersionError) Is added in v0.3.0

type UpdateResult

type UpdateResult struct {
	Catalog string
	Skipped bool
	Err     error
}

type Updater

type Updater interface {
	Update(ctx context.Context) error
}

type VersionEntry

type VersionEntry struct {
	Version       string `yaml:"version"`
	ArchiveSHA256 string `yaml:"archiveSHA256,omitempty"`
	SourceSHA256  string `yaml:"sourceSHA256,omitempty"`
}

type VersionResult

type VersionResult struct {
	Catalog string
	Version string
}

Jump to

Keyboard shortcuts

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