Documentation
¶
Overview ¶
Package look is the reading half of one look of the engine's loop at a driven pursuit: with no transaction open it reads which changes have landed from version control, asks the forge whether each run's PR is open, merged or closed when the forge's next time has come, loads the harness binding and reads the machine's slots, and returns all of it as one result. It touches no store and no clock but the time in its payload, and it only reads the forge: it never merges, closes or edits a PR.
Index ¶
Constants ¶
const ( ForgeOK = "ok" ForgeFailed = "failed" )
What a look did with the forge. Empty is that it did not ask: there is no forge that reads PR states, no PR to ask about, or its next time had not come.
const NoBind = "this engine was given no way to load the harness binding, so it can start no run"
NoBind is why no run can start on an engine that was given no way to load a harness binding.
const Scheme = "https://"
Scheme is how a PR's value must start for the forge to be asked about it. A PR is a harness's word and reaches the forge's tool as an argument, so any other value is never asked about and stays unseen.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(payload json.RawMessage) error
Check refuses a payload a look cannot use: one without its store directory, pursuit or time, or with a PR that names no run or does not start with Scheme.
Types ¶
type Binding ¶
type Binding struct {
Level int `json:"level"`
Start string `json:"start"`
Result string `json:"result"`
Stop string `json:"stop"`
}
Binding is the harness binding's level and command lines, as a run is started with them.
type Deps ¶
type Deps struct {
Env []string
NewForge func(root string) forge.Forge
Bind func(root string) (Binding, error)
Slots func() int
}
Deps is what a look reads through. Env is the environment git runs in. NewForge gives the forge of a repo root; nil, a nil forge or one that does not read PR states means the forge is not asked. Bind gives the binding of a repo root, or why no run can start there; nil means none can. Slots nil means 1.
type In ¶
type In struct {
Store string `json:"store"`
Pursuit string `json:"pursuit"`
Since time.Time `json:"since,omitzero"`
PRs []PR `json:"prs,omitempty"`
ForgeFailures int `json:"forge_failures"`
ForgeNext time.Time `json:"forge_next,omitzero"`
At time.Time `json:"at"`
}
In is a look's payload: the store directory, the pursuit and when it was created, the PRs to ask the forge about, the forge's backoff as the store held it, and At, the time of the tick that asked for the look. At is the look's only clock.
type Out ¶
type Out struct {
Landed map[string]progress.Landing `json:"landed"`
VCSError string `json:"vcs_error,omitempty"`
Seen []Seen `json:"seen,omitempty"`
Unread []string `json:"unread,omitempty"`
Forge string `json:"forge,omitempty"`
ForgeError string `json:"forge_error,omitempty"`
ForgeRetry time.Time `json:"forge_retry,omitzero"`
Bind Binding `json:"bind"`
BindError string `json:"bind_error,omitempty"`
Slots int `json:"slots"`
}
Out is a look's result. Landed is what version control showed, and VCSError why it could not be read. Seen holds each PR state the forge gave, Unread each PR it could not read and why, Forge what the asking came to, with ForgeError when it failed and ForgeRetry the time a rate limit named. Bind is the binding, or BindError says why no run can start. Slots is how many runs may be live at once on this machine.