Documentation
¶
Overview ¶
Package g2 talks to the aqua-registry-g2 repository.
Index ¶
- Constants
- func BranchID(branch string) (string, bool)
- func BranchName(pkgName string) string
- func ClaimDefinition(pkgName string) string
- func EncodePackageName(name string) string
- func ErrNoBranchToRename(err error) bool
- func ErrNoTemplate(err error) bool
- func HeadBranchName(id string) string
- func IDBranchName(id string) string
- func IgnorePackage(content, pkgName, reason string) (string, bool, error)
- func IsClaim(cfg *aquag2.Config) bool
- func IsVersionHeadBranch(id, branch string) bool
- func MintID(now time.Time, taken map[string]struct{}) string
- func RemoveBranchName(id string) string
- func VersionHeadBranchName(id, version string) string
- type Breadth
- type Client
- func (c *Client) Branch(pkgName string) (string, bool)
- func (c *Client) BranchSHA(ctx context.Context, branch string) (string, error)
- func (c *Client) Commit(ctx context.Context, branch, parent, message string, files []*File) error
- func (c *Client) Config(ctx context.Context, pkgName string) (*aquag2.Config, error)
- func (c *Client) ConfigOnRef(ctx context.Context, ref string) (*aquag2.Config, error)
- func (c *Client) CreateIndexPullRequest(ctx context.Context, logger *slog.Logger, base, title, body string) (*gogithub.PullRequest, error)
- func (c *Client) CreatePullRequest(ctx context.Context, logger *slog.Logger, pkgName, title, body string) (*gogithub.PullRequest, error)
- func (c *Client) CreatePullRequestFrom(ctx context.Context, logger *slog.Logger, head, base, title, body string) (*gogithub.PullRequest, error)
- func (c *Client) EnsurePackageBranch(ctx context.Context, pkgName string) (string, error)
- func (c *Client) File(ctx context.Context, ref, path string) (string, error)
- func (c *Client) HeadBranch(pkgName string) (string, bool)
- func (c *Client) Identify(ctx context.Context, pkgName string, plan *Identification) error
- func (c *Client) Index(ctx context.Context, ref string) (*aquag2.Index, error)
- func (c *Client) IndexPullRequest(ctx context.Context) (*gogithub.PullRequest, error)
- func (c *Client) IsVersionHeadBranch(pkgName, branch string) bool
- func (c *Client) Label(ctx context.Context, logger *slog.Logger, number int, name string)
- func (c *Client) PackagesInFlight(ctx context.Context) (map[string]struct{}, error)
- func (c *Client) PlanIdentity(ctx context.Context, pkgName, id string) (*Identification, error)
- func (c *Client) RegistryConfig(ctx context.Context, ref string) (*RegistryConfig, error)
- func (c *Client) RemoveBranch(pkgName string) (string, bool)
- func (c *Client) RenamePackage(ctx context.Context, logger *slog.Logger, from, to string) (*aquag2.Config, error)
- func (c *Client) UseIdentities(ids *Identities)
- func (c *Client) Version(ctx context.Context, pkgName, version string) (*aquag2.Registry, error)
- func (c *Client) VersionFiles(ctx context.Context, pkgName string) ([]string, error)
- func (c *Client) VersionHeadBranch(pkgName, version string) (string, bool)
- func (c *Client) Versions(ctx context.Context, logger *slog.Logger, pkgName string) (map[string]struct{}, error)
- func (c *Client) VersionsOnRef(ctx context.Context, logger *slog.Logger, ref string) (map[string]struct{}, error)
- func (c *Client) WaitingPullRequest(ctx context.Context, pkgName string) (*gogithub.PullRequest, error)
- type Definitions
- type File
- type Identification
- type Identities
- func (i *Identities) Branch(pkgName string) (string, bool)
- func (i *Identities) HeadBranch(pkgName string) (string, bool)
- func (i *Identities) ID(pkgName string) (string, bool)
- func (i *Identities) IsVersionHeadBranch(pkgName, branch string) bool
- func (i *Identities) Mint(pkgName string) string
- func (i *Identities) Package(id string) (string, bool)
- func (i *Identities) RemoveBranch(pkgName string) (string, bool)
- func (i *Identities) VersionHeadBranch(pkgName, version string) (string, bool)
- type IgnoredPackage
- type MovedFile
- type RegistryConfig
Constants ¶
const BranchPrefix = "pkg_"
BranchPrefix marks the branches holding a package's generated registry.json. It keeps them out of the way of main and of any operational branch, and lets one branch ruleset cover all of them with a single pattern.
const ConfigFileName = aquag2.ConfigFileName
ConfigFileName is the definition at the root of a package's branch, the file registry.json is generated from.
const HeadBranchPrefix = "ar2_"
HeadBranchPrefix marks the branches ar2 opens pull requests from. They are separate from the package branches so that a ruleset protecting the latter doesn't have to make an exception for the branch a pull request comes from.
const IndexBranch = HeadBranchPrefix + "index"
IndexBranch is where an update to the catalogue is committed.
One fixed branch rather than one per run: the catalogue is only ever added to, so two runs writing to the same branch produce the same thing as two runs one after the other. A run whose pull request is still open adds to it instead of opening another, which is what keeps a scheduled reconciliation from leaving a trail of them behind.
const IndexFileName = aquag2.IndexFileName
IndexFileName is the catalogue on the default branch.
const NeedsDefinitionLabel = "needs-definition"
NeedsDefinitionLabel marks the pull requests whose versions are waiting for a definition.
What it is for is finding them together: they are the one kind of pull request that doesn't merge itself, and a maintainer who has half an hour for the registry wants the list.
const RegistryConfigFileName = "ar2.yaml"
RegistryConfigFileName is the registry's own configuration, on the default branch.
It says what ar2 should do differently for this registry, which is nothing about any one package's contents: those live on the package's branch. Today that is the list of packages to leave alone.
const TemplateDir = "template"
TemplateDir is the directory on main holding the files a new package branch starts with. Its contents are copied to the branch at the same paths, so a workflow lives at templates/.github/workflows/ and lands at .github/workflows/.
A package branch needs the CI workflow before a pull request into it can be checked, because a pull_request workflow is read from the branch the pull request targets. The files live on main so that changing them changes what every new branch gets.
Variables ¶
This section is empty.
Functions ¶
func BranchID ¶ added in v0.1.0
BranchID returns the id a package branch is named after, and false for a branch named after the package itself.
An id is a decimal number and an encoded package name is never one: a package name holds at least one slash, which the encoding writes as "_2f".
func BranchName ¶
BranchName returns the branch a package's generated registry.json was held on while branches were named after the package.
Nothing addresses a package this way any more: a branch is named after the package's id, so that a repository being renamed doesn't move anything. It is what 'ar2 identify' reads to carry a package over to the branch named after its id, and it goes when those branches go.
func ClaimDefinition ¶ added in v0.1.0
ClaimDefinition is what a package branch is created holding: the name of the package and nothing else.
The branch is named after an id, so nothing about it says which package it holds. The definition is where a branch answers for itself, and it has to answer from its first commit -- before that, a run that took the package over again would find no branch for it and make a second one. The conversion from aqua-registry replaces this with the definition itself, which is the moment the package is taken over.
func EncodePackageName ¶
EncodePackageName escapes a package name so it can be used as a git ref.
Every character outside [A-Za-z0-9.-] becomes an underscore followed by two lowercase hex digits. Escaping the underscore itself as well makes the mapping reversible, which "/" -> "__" is not: 12 package names already contain an underscore, so that scheme is ambiguous in principle.
cli/cli -> cli_2fcli ipinfo/cli/grepip -> ipinfo_2fcli_2fgrepip sr.ht/~charles/rq -> sr.ht_2f_7echarles_2frq po3rin/github_link_creator -> po3rin_2fgithub_5flink_5fcreator
The result stays within [A-Za-z0-9._-], so it needs no further escaping in a URL. Percent-encoding would not: a branch named with "%7E" has to be written "%257E" in a raw URL, because the server decodes the escape before looking the ref up.
The encoded name also contains no "/", so it is a single ref segment. That removes the directory/file conflict that would otherwise make "ipinfo/cli" and "ipinfo/cli/grepip" unable to coexist as branches; aqua-registry has 30 such pairs.
func ErrNoBranchToRename ¶ added in v0.0.27
ErrNoBranchToRename says the rename failed because the registry doesn't hold the package.
Which is not a failure of the rename so much as a rename with nothing to do: what the caller has to move is the package's place in its own records, and the registry only ever sees the new name.
func ErrNoTemplate ¶
ErrNoTemplate reports whether an error is the missing template. It stops a run rather than being retried per package: every package would hit it, and walking the whole registry to say so wastes a run's worth of API calls.
func HeadBranchName ¶
HeadBranchName returns the branch a pull request for the package with this id is opened from.
It carries no version: one pull request adds every version of the package that a run found, which keeps the number of pull requests down and, more importantly, keeps two of them from targeting the same package branch at once. Two would conflict on merge, since the second is written against a base the first has moved.
func IDBranchName ¶ added in v0.1.0
IDBranchName returns the branch holding the package whose id this is.
func IgnorePackage ¶ added in v0.0.25
IgnorePackage returns the registry's configuration with the package added to ignored_packages, and reports whether it was added.
The file is spliced rather than parsed and written back. It is read by people and carries comments and folded prose that a round trip through a YAML encoder would reformat, so what comes back differs from what went in only by the lines added.
The entry goes at the top of the list. The list is read as a set -- nothing depends on the order -- and inserting at the top means the only line that has to be found is the one the list starts on, which is the one thing a parser can give exactly.
func IsClaim ¶ added in v0.1.0
IsClaim reports whether a definition is only a branch's claim to a package, rather than a definition to generate from.
A definition says where the package comes from; the claim says nothing but its name.
func IsVersionHeadBranch ¶ added in v0.0.37
IsVersionHeadBranch reports whether the branch is one of the package's version branches.
A prefix match isn't enough, because one id can be the beginning of another: 1790772680 starts with 179077268. What tells them apart is what follows the separator -- an encoded version, in which an underscore only ever begins an escape.
func MintID ¶ added in v0.0.41
MintID returns an identifier for a package that no other package has.
A package's branch is named after this rather than after the package, because a name is not an identity: a repository can be renamed, and the name it leaves behind can be taken by a different repository. What the identifier has to be is unchanging, unique, and mintable without asking anybody -- not random, and not meaningful.
So it is the time it was minted, in seconds. Ten characters, in an order that is the order packages were taken over, and readable with `date -r`. The randomness a UUID carries would be 122 bits spent on a few thousand identifiers that are minted one at a time, and it would be paid for in the table a consumer resolves through: high-entropy strings don't compress, and there is one per package in it.
Uniqueness doesn't rest on the clock. Whoever mints holds the catalogue, so taken says which identifiers are already spoken for, and a second that is taken is stepped past. Nothing else needs a lock: what would make two packages share a branch is two identical identifiers, and that is a question this can answer before it answers anything else.
func RemoveBranchName ¶ added in v0.0.25
RemoveBranchName returns the branch the pull request that stops serving the package is opened from.
Its own branch rather than the one a version's pull request uses, because it goes the other way: into the default branch, carrying the registry's configuration and the catalogue. A package could have both open at once, and they must not be the same ref.
func VersionHeadBranchName ¶ added in v0.0.34
VersionHeadBranchName returns the branch a pull request for one version alone is opened from.
One version has a branch of its own when what was generated for it can't merge: it names a file the archive doesn't hold, so the definition has to say something it doesn't, and until somebody writes that the version waits. In the pull request with the rest it would keep the versions that were right from merging, which is the whole reason for a branch per version here and one per package everywhere else.
Two of these don't conflict with each other or with the package's own, because a pull request into the package branch moves it only when it merges, and this one doesn't until a person has been.
Types ¶
type Breadth ¶ added in v0.0.15
type Breadth struct {
// Versions ends the turn once the package has that many. Default 5.
Versions int `yaml:"versions,omitempty"`
// Attempts ends the turn after that many versions have been tried, whether or
// not they worked.
//
// A release with no assets, or one whose signature can't be verified yet,
// produces nothing, and the newest versions are the likeliest to -- which are
// the ones a turn starts from. Without this a package stops short of Versions
// every turn and takes one every lap forever.
//
// Unset, a turn tries exactly as many versions as it wants and no more, so a
// version that fails costs the package a lap.
Attempts int `yaml:"attempts,omitempty"`
}
Breadth is how far a run goes with a package the registry holds little of.
A run is bounded, and every package wants all of its versions. Spending the whole run on the first one leaves the rest with nothing at all, and a package with nothing can't be installed from the registry; so a package short of Versions gets enough of a turn to reach it and the run moves on.
What the right number is changes. While the registry is being filled it wants to be small, so that every package gets its newest versions before any package gets its history. Once that is done the packages arriving are new ones, and a new package with two usable versions is barely better than one with none, so it wants to be larger. The registry says which it is, because nothing here can tell.
func (*Breadth) GetAttempts ¶ added in v0.0.15
GetAttempts is how many versions may be tried to get there, or zero for as many as are wanted and no more.
func (*Breadth) GetVersions ¶ added in v0.0.15
GetVersions is how many versions ends a package's turn.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads and writes aqua-registry-g2.
func (*Client) Branch ¶ added in v0.1.0
Branch is the branch holding the package, and false when the registry holds none.
func (*Client) BranchSHA ¶
BranchSHA returns the commit a branch points at, or an empty string when the branch doesn't exist.
func (*Client) Commit ¶
Commit writes the files onto a new commit on top of parent and points branch at it.
The commit is built through the Git data API rather than a checkout. A package branch is an orphan and there are as many of them as there are packages, so cloning to write one file would be the expensive way to do this.
GitHub signs the commits it creates this way when the caller is a GitHub App installation or GitHub Actions, which is how ar2 runs, so they satisfy a ruleset requiring signatures. A user access token produces unsigned commits, so a local run can't produce something a signature ruleset accepts; that only affects trying ar2 out by hand.
It is the pull request's client that writes, not the reading one. A commit onto a branch that already has an open pull request is a synchronize event, and one made with GITHUB_TOKEN leaves that pull request's checks waiting for approval.
func (*Client) Config ¶
Config returns the package's definition, or nil when its branch has none.
A package without one is a package aqua-registry-g2 hasn't taken over yet: its definition still lives in aqua-registry, and the next pull request for it carries the converted one along with the generated files.
func (*Client) ConfigOnRef ¶ added in v0.0.34
ConfigOnRef returns the definition a ref holds, or nil when it holds none.
The ref matters when the definition being generated from isn't the one the registry has merged: a pull request that carries a definition somebody has just written is the only place that version of it exists.
func (*Client) CreateIndexPullRequest ¶
func (c *Client) CreateIndexPullRequest(ctx context.Context, logger *slog.Logger, base, title, body string) (*gogithub.PullRequest, error)
CreateIndexPullRequest opens a pull request updating the catalogue.
func (*Client) CreatePullRequest ¶
func (c *Client) CreatePullRequest(ctx context.Context, logger *slog.Logger, pkgName, title, body string) (*gogithub.PullRequest, error)
CreatePullRequest opens a pull request from the package's head branch into its package branch.
func (*Client) CreatePullRequestFrom ¶ added in v0.0.25
func (c *Client) CreatePullRequestFrom(ctx context.Context, logger *slog.Logger, head, base, title, body string) (*gogithub.PullRequest, error)
CreatePullRequestFrom opens a pull request from head into base.
It is the pull request client that opens it rather than the reading one, whatever the branches are: a pull request opened with GITHUB_TOKEN gets its checks in an approval-required state, so nothing would check it until a person pressed a button.
func (*Client) EnsurePackageBranch ¶
EnsurePackageBranch creates the package's branch if it doesn't exist and returns the commit it points at.
The branch is an orphan: it shares no history with main, which is what keeps a commit to one package from rewriting a tree that every other package is under. Its first commit carries the template files rather than being empty, so that a pull request into it is checked by the same CI as everywhere else.
func (*Client) File ¶ added in v0.0.19
File returns a file of the repository, or an empty string when there is none.
Absent isn't a failure. A file the registry hasn't been written with yet -- one added to what a run maintains after the registry was created -- is missing rather than wrong, and what reads it is deciding whether to write it.
func (*Client) HeadBranch ¶ added in v0.1.0
HeadBranch is the branch a pull request for the package is opened from, and false when the registry holds no branch for it.
func (*Client) Identify ¶ added in v0.0.42
Identify creates the branch named after the package's id.
Created rather than the versions generated again: a package's history is every release it published, downloaded and hashed and opened on six machines to get there, and the id is the same history addressed by something that doesn't change when the name does.
Created with the app that creates branches, which is what the ruleset requiring status checks lets through. Committing onto an existing package branch takes a pull request, which is why the corrections are part of the commit the branch starts at.
func (*Client) Index ¶
Index returns the catalogue, or an empty one when the repository has none yet.
func (*Client) IndexPullRequest ¶
IndexPullRequest returns the open pull request updating the catalogue, or nil.
func (*Client) IsVersionHeadBranch ¶ added in v0.1.0
IsVersionHeadBranch reports whether the branch is one of the package's version branches.
func (*Client) Label ¶ added in v0.0.34
Label puts a label on a pull request, making it first when the repository hasn't got it.
Said rather than failed for, like the label of the release: what the pull request carries matters more than what it is filed under.
func (*Client) PackagesInFlight ¶
PackagesInFlight returns the packages that already have an open pull request.
Asking the repository which versions it holds can't see a pull request that hasn't merged yet, so without this a run would open a second pull request for work that is already waiting — including work waiting precisely because its CI failed.
Every open pull request is listed once per run rather than checking each package, because a run touches many packages and there are rarely many pull requests.
func (*Client) PlanIdentity ¶ added in v0.0.42
PlanIdentity reads what creating the package's id branch would do, and returns nil when the branch is already there.
Reading it separately from doing it is what lets the migration be looked at before it runs: it walks every package the registry holds, and the branches it creates can't be deleted afterwards by anything ar2 has.
func (*Client) RegistryConfig ¶ added in v0.0.9
RegistryConfig returns the registry's configuration, or an empty one when the repository has none. A registry that asks for nothing different needs no file.
func (*Client) RemoveBranch ¶ added in v0.1.0
RemoveBranch is the branch the pull request that stops serving the package is opened from.
func (*Client) RenamePackage ¶ added in v0.0.20
func (c *Client) RenamePackage(ctx context.Context, logger *slog.Logger, from, to string) (*aquag2.Config, error)
RenamePackage puts the package's definition under the name its repository has now, in a pull request into the branch holding it.
The branch doesn't move, which is what naming it after an id is for: a rename used to carry the whole branch over, and everything that had written the old name down was left pointing at nothing. What has to change is the definition, because the definition is the only thing that says which package the branch holds -- one still naming the old package would be found under a name nobody uses, and a run asking for the new name would find no branch and make a second one.
The old name becomes an alias, which is how a configuration still asking for it resolves.
It returns the definition as the pull request writes it, and nil when there was nothing to do: a definition that already names the new package is what a second run of the same rename sees.
func (*Client) UseIdentities ¶ added in v0.1.0
func (c *Client) UseIdentities(ids *Identities)
UseIdentities tells the client what each package's branch is named after.
Read once, before anything is read or written, because every branch this addresses is named after an id. A client that was never told holds no package as far as the readers are concerned, and refuses to create a branch rather than inventing where to put one.
func (*Client) Version ¶
Version returns the registry.json the repository holds for one version of a package, or nil when it holds none.
func (*Client) VersionFiles ¶ added in v0.0.25
VersionFiles returns every file the package's branch holds under versions/, as paths from the root of the branch.
Every file rather than the registry.json of each version. What has to go when a package stops being served is whatever is there, and a version directory holding something this doesn't know about is exactly what would be left behind by a list built from names.
func (*Client) VersionHeadBranch ¶ added in v0.1.0
VersionHeadBranch is the branch a pull request for one version alone is opened from.
func (*Client) Versions ¶
func (c *Client) Versions(ctx context.Context, logger *slog.Logger, pkgName string) (map[string]struct{}, error)
Versions returns the versions of the package whose registry.json is in the repository.
The repository is asked rather than a local record of what has been generated, because what matters is whether a version is merged, not whether it was once produced. A pull request that fails CI is never merged, and a record of "already generated" would stop it from ever being retried — exactly for the packages that need attention. Asking the repository makes a run idempotent instead.
The Git Data API rather than the Contents API, which stops at 1,000 entries in a directory and says so only by returning fewer: a package with more versions than that would have looked as though the ones it didn't return were missing, and been generated again on every run.
func (*Client) VersionsOnRef ¶ added in v0.0.34
func (c *Client) VersionsOnRef(ctx context.Context, logger *slog.Logger, ref string) (map[string]struct{}, error)
VersionsOnRef returns the versions a ref holds a registry.json for.
Which for a package branch is what the registry holds, and for the head branch of a pull request is what that pull request would add. The second is what a regeneration of something not yet merged works from: the versions are on the branch and nowhere else.
func (*Client) WaitingPullRequest ¶ added in v0.0.34
func (c *Client) WaitingPullRequest(ctx context.Context, pkgName string) (*gogithub.PullRequest, error)
WaitingPullRequest returns the package's open pull request of versions waiting for a definition, or nil when it has none.
It is the one whose head branch is named after a version rather than after the package: the pull request a run opens for everything it generated is on the package's own branch, and this is the other kind.
type Definitions ¶ added in v0.1.0
type Definitions interface {
Files(ctx context.Context, logger *slog.Logger, prefix, path string) (map[string]string, error)
}
Definitions is the definition on every package branch, read in one pass.
One query per hundred branches rather than a request per package, which is what makes reading the whole table affordable at the start of a run.
type File ¶
type File struct {
// Path is where the file goes on the package branch, such as
// versions/v1.2.3/registry-1.json.
Path string
Content string
// Deleted takes the path out of the tree instead of writing it. The entry is sent
// with a null sha, which is how the Git data API says a path is gone.
Deleted bool
}
File is a file to commit.
func CatalogueFiles ¶ added in v0.0.25
CatalogueFiles renders the files the catalogue is made of.
The table that resolves a name is written with it rather than beside it. It is the catalogue read the other way round -- a name, and every name a package used to have, to where the package is -- so rendering them together is what keeps them from describing different registries.
type Identification ¶ added in v0.0.42
type Identification struct {
// Branch is the ref to create.
Branch string
// Parent is where the package's branch is now. The new branch starts there, so
// nothing is copied and the record of how each version arrived is still readable.
Parent string
// Config is the definition with the package's own name written into it, or empty
// when it already says it. A branch named after an id doesn't say which package it
// holds, so the definition has to.
Config string
// Moved is the files whose version directory was written before a version was
// escaped into one path segment.
Moved []*MovedFile
}
Identification is what putting a package on the branch named after its id would do.
type Identities ¶ added in v0.1.0
type Identities struct {
// contains filtered or unexported fields
}
Identities is what each package's branch is named after.
A branch named after an id doesn't say which package it holds, so this is read from the branches themselves: the branch name carries the id and the definition on the branch carries the package's name. Every branch answers for itself, where a table kept anywhere else -- the catalogue, say -- could disagree with what the branches hold and send a package's versions to another package's branch.
A package the table doesn't have is one the registry doesn't hold yet. Taking it over mints its id, and the next reading of the branches finds it there.
func NewIdentities ¶ added in v0.1.0
func NewIdentities(logger *slog.Logger, files map[string]string) *Identities
NewIdentities reads the table out of the definitions the package branches hold, keyed by branch name.
A branch still named after the package is not in it. Those are the ones 'ar2 identify' carries over, and addressing one by the name it happens to have would write to a branch nothing reads.
func ReadIdentities ¶ added in v0.1.0
func ReadIdentities(ctx context.Context, logger *slog.Logger, defs Definitions) (*Identities, map[string]string, error)
ReadIdentities reads what every package's branch is named after, and returns the definition each branch holds along with it.
The definitions come back because they are what the table was read out of: a caller that works through every definition -- the tidy, the reconciliation -- would otherwise read the same hundred-branch pages again to get them.
func (*Identities) Branch ¶ added in v0.1.0
func (i *Identities) Branch(pkgName string) (string, bool)
Branch is the branch holding the package, and false when the registry holds none.
func (*Identities) HeadBranch ¶ added in v0.1.0
func (i *Identities) HeadBranch(pkgName string) (string, bool)
HeadBranch is the branch a pull request for the package is opened from.
func (*Identities) ID ¶ added in v0.1.0
func (i *Identities) ID(pkgName string) (string, bool)
ID is the id the package's branch is named after, and false for a package the registry doesn't hold.
func (*Identities) IsVersionHeadBranch ¶ added in v0.1.0
func (i *Identities) IsVersionHeadBranch(pkgName, branch string) bool
IsVersionHeadBranch reports whether the branch is one of the package's version branches.
func (*Identities) Mint ¶ added in v0.1.0
func (i *Identities) Mint(pkgName string) string
Mint gives a package the registry doesn't hold the id its branch will be named after, and records it so that the next one steps past it.
func (*Identities) Package ¶ added in v0.1.0
func (i *Identities) Package(id string) (string, bool)
Package is the package the branch whose id this is holds, and false when no branch says it holds one.
func (*Identities) RemoveBranch ¶ added in v0.1.0
func (i *Identities) RemoveBranch(pkgName string) (string, bool)
RemoveBranch is the branch the pull request that stops serving the package is opened from.
func (*Identities) VersionHeadBranch ¶ added in v0.1.0
func (i *Identities) VersionHeadBranch(pkgName, version string) (string, bool)
VersionHeadBranch is the branch a pull request for one version alone is opened from.
type IgnoredPackage ¶ added in v0.0.9
type IgnoredPackage struct {
Name string `yaml:"name"`
// Reason is why, in prose. The next person to wonder why a package isn't in the
// registry reads this file and nothing else, so an entry without one says only
// that somebody decided something.
Reason string `yaml:"reason,omitempty"`
}
IgnoredPackage is a package a run doesn't look at.
type MovedFile ¶ added in v0.0.42
type MovedFile struct {
From string
To string
// SHA is the blob, which is written at the new path as it is: the file didn't
// change, only where it sits.
SHA string
// Mode is the file's mode, carried over for the same reason.
Mode string
}
MovedFile is a file that belongs at another path.
type RegistryConfig ¶ added in v0.0.9
type RegistryConfig struct {
// IgnoredPackages are the packages a run doesn't look at.
//
// A package that can't be generated is tried again on every run: it costs API
// calls, and it fills the summary of what wasn't published with the same names
// until whoever reads it stops reading. A repository that was deleted or renamed
// will never generate, and a package somebody decided not to migrate never
// should, and neither is a thing to rediscover every half hour.
IgnoredPackages []*IgnoredPackage `yaml:"ignored_packages,omitempty"`
// Breadth is how much of a run one package may take while it has little in the
// registry.
Breadth *Breadth `yaml:"breadth,omitempty"`
}
RegistryConfig is what RegistryConfigFileName holds.
func (*RegistryConfig) Ignored ¶ added in v0.0.9
func (c *RegistryConfig) Ignored() map[string]struct{}
Ignored returns the names to leave alone, as a set.