versions

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package versions writes the list of versions a package branch holds.

The list is the branch's own directories, so nothing here decides what it says. What it is for is reading: a reader asking which versions there are, when each was published or whether the file it has is still the one the registry serves would otherwise read the branch's tree and then a file per version.

It is written onto the package branch, beside the definition, because that is where the versions are. A copy on the default branch would be one file every package writes to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	// Packages narrows the run to the packages named. Naming none does every package.
	Packages []string
	// Branches narrows the run to the branches named, which is what a branch's own
	// workflow passes: it knows the branch it is running on and not the package.
	Branches []string
	// Limit bounds how many branches one run writes to, 0 for as many as there are.
	Limit int
	// DryRun says what would be written without writing it.
	DryRun bool
}

Args holds what one run does.

type Controller

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

Controller writes the lists.

func New

func New(registry Registry, defs map[string]string) *Controller

New creates a Controller.

func (*Controller) Write

func (c *Controller) Write(ctx context.Context, logger *slog.Logger, args *Args) error

Write works through the branches, writing the list of each whose list has changed.

A branch whose list is already what it should be is left alone, so a run over a registry that is up to date writes nothing.

type Registry

type Registry interface {
	Branch(pkgName string) (string, bool)
	BranchSHA(ctx context.Context, branch string) (string, error)
	VersionsTree(ctx context.Context, ref string) (string, error)
	VersionsOnRef(ctx context.Context, logger *slog.Logger, ref string) (map[string]struct{}, error)
	File(ctx context.Context, ref, path string) (string, error)
	Push(ctx context.Context, branch, parent, message string, files []*g2.File) error
}

Registry is the part of aqua-registry-g2 this reads and writes.

Jump to

Keyboard shortcuts

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