Documentation
¶
Overview ¶
Package index maintains aqua-registry-g2's catalogue of the packages it holds.
Everything else about a package lives on its own branch, which is what keeps one package's history out of another's. Searching can't work that way: it reads a name and a description for every package before knowing which one is wanted. So the catalogue is a single file on the default branch, and it has to be kept in step with the branches by hand.
Index ¶
- type AutoMerger
- type Controller
- func (c *Controller) AddPackage(ctx context.Context, logger *slog.Logger, pkgName string, cfg *aquag2.Config) error
- func (c *Controller) Rename(ctx context.Context, logger *slog.Logger, from, to string, cfg *aquag2.Config) error
- func (c *Controller) Sync(ctx context.Context, logger *slog.Logger) error
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoMerger ¶ added in v0.0.5
AutoMerger turns a pull request over to its checks.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller adds packages to the catalogue.
func New ¶
func New(registry Registry, automerge AutoMerger, baseBranch string) *Controller
New creates a Controller. automerge may be nil, and then the catalogue's pull requests wait for someone.
func (*Controller) AddPackage ¶
func (c *Controller) AddPackage(ctx context.Context, logger *slog.Logger, pkgName string, cfg *aquag2.Config) error
AddPackage puts one package into the catalogue.
This is the path a run takes as it takes a package over: it has just built the definition, so nothing is read back and no branches are listed. The definition is passed in because the branch doesn't hold it yet — it is in the pull request that brings the package, which is the moment the catalogue can first describe it.
func (*Controller) Rename ¶ added in v0.0.20
func (c *Controller) Rename(ctx context.Context, logger *slog.Logger, from, to string, cfg *aquag2.Config) error
Rename lists a package under its new name and stops listing it under the old one.
Both in one commit. A catalogue holding the old name as a package and the new one as a package whose alias is that name says two things about one name, and nothing can decide which of them answers -- which is a state it is checked for rather than resolved.
func (*Controller) Sync ¶
Sync puts every package that has a branch into the catalogue.
This is what catches what the other path missed. A package whose run failed after committing its definition, or whose pull request was never merged, is left out of the catalogue and nothing else would ever notice.
type Registry ¶
type Registry interface {
Index(ctx context.Context, ref string) (*aquag2.Index, error)
File(ctx context.Context, ref, path string) (string, error)
PackageBranches(ctx context.Context) ([]string, error)
Config(ctx context.Context, pkgName string) (*aquag2.Config, error)
BranchSHA(ctx context.Context, branch string) (string, error)
Commit(ctx context.Context, branch, parent, message string, files []*g2.File) error
IndexPullRequest(ctx context.Context) (*gogithub.PullRequest, error)
CreateIndexPullRequest(ctx context.Context, base, title, body string) (*gogithub.PullRequest, error)
}
Registry is what the catalogue is built from and written to.