Documentation
¶
Overview ¶
Package factsgithub is the github source's workflow facts: the pull requests a sweep plans over, as automation.Units, and their author facts, as views.Facts. It reads the store, the workspace snapshot and the local checkouts; only Moved asks GitHub.
Index ¶
- Constants
- func InventoryInputs(st *inventory.Store) sweep.Inputs
- func LocalGit(g gitx.Git) sweep.LocalGit
- func SnapshotOf(set *workspace.Set) sweep.Snapshot
- type Branches
- type Candidate
- type Deps
- type Provider
- func (p *Provider) Author(ctx context.Context, u unit.Unit, needLocal bool) (*dview.AuthorFacts, error)
- func (p *Provider) Candidate(ctx context.Context, u unit.Unit, round string) (Candidate, bool, error)
- func (p *Provider) Carded(ctx context.Context) ([]unit.Unit, error)
- func (p *Provider) Due() time.Time
- func (p *Provider) Facts(ctx context.Context, u unit.Unit) (workflow.Facts, error)
- func (p *Provider) List(ctx context.Context, id unit.ProviderID) ([]unit.Unit, error)
- func (p *Provider) Moved(ctx context.Context, units []unit.Unit) ([]unit.Unit, error)
- func (p *Provider) Prefetch(ctx context.Context, units []unit.Unit) error
- func (p *Provider) Refresh(ctx context.Context) error
- func (p *Provider) Settle(ctx context.Context, st automation.State) error
- type RoundState
- type Store
- type StubReader
Constants ¶
const ( RoundFollowup = "follow-up" RoundFirst = "first" RoundAddress = "address" )
The rounds a Candidate names.
Variables ¶
This section is empty.
Functions ¶
func InventoryInputs ¶
InventoryInputs are the planning inputs as the inventory stores them.
Types ¶
type Branches ¶
type Branches interface {
LocalBranchTip(ctx context.Context, dir, branch string) (string, error)
CheckedOutAt(ctx context.Context, dir, branch string) (string, error)
HasCommit(ctx context.Context, dir, oid string) (bool, error)
IsAncestor(ctx context.Context, dir, ancestor, commit string) (bool, error)
}
Branches reads what a first round's review workspace would find of the pull request's head branch in the local checkout.
type Candidate ¶
type Candidate struct {
Round string
Workspace wsdomain.Workspace
Facts sweep.Facts
Fingerprint string
ChecksHead string
LastReviewAt time.Time
Observed bool
}
Candidate is what a round is planned with.
type Deps ¶
type Deps struct {
Inputs sweep.Inputs
Store Store
Snapshot sweep.Snapshot
Books sweep.Books
Rounds sweep.Rounds
Git sweep.LocalGit
Branches Branches
Stubs StubReader
Cfg func() config.Config
// Sink is the view sink whose columns the workspaces report as statuses.
Sink string
Clock port.Clock
Changes port.Changes
Teams func(ctx context.Context) ([]string, error)
// Agents are the agents by name, for the answer a start block waits on.
Agents map[string]turns.Agent
Intents func() *dintent.Registry
}
Deps are what the provider reads. Changes, Teams, Agents and Intents may be nil: without Changes every call reads the store again.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the github source's facts.
func (*Provider) Author ¶
func (p *Provider) Author(ctx context.Context, u unit.Unit, needLocal bool) (*dview.AuthorFacts, error)
Author is what the views read of u's pull request to project its author card; with needLocal, also its author workspace's checkout, as far as dview.AuthorColumn may need it. Nil when the store holds no such pull request.
func (*Provider) Candidate ¶
func (p *Provider) Candidate(ctx context.Context, u unit.Unit, round string) (Candidate, bool, error)
Candidate is the round of u the facts plan, with what its turn is sent with; false when that round is not due.
func (*Provider) Carded ¶
Carded lists, in order, the pull requests a workspace on the user's board targets: those whose cards the facts move without a turn.
func (*Provider) Due ¶
Due is the earliest instant after now a decision of the last evaluation changes with no input changing.
func (*Provider) Facts ¶
Facts are the pr facts of u; a pull request the store does not hold yet has those that need no row.
func (*Provider) List ¶
List is every unit a workflow over pull requests may act on: those a sweep plans over, the open ones nothing lapsed, the ones with an open turn and the ones with an answer waiting.
func (*Provider) Moved ¶
Moved reads, in one batched read before the loop lock, the stub of each unit's pull request and returns those GitHub shows closed or moved since the inventory row the plan read: under the lock a round asks GitHub nothing. A failed read moves them all. Units are planned again after the next fast run. A unit whose rounds are all observed is not read, as no round of it would go out.
func (*Provider) Prefetch ¶
Prefetch reads the facts of units in one query, for the Author calls that follow on the same view.
func (*Provider) Refresh ¶
Refresh records, before the plan, the start blocks the agent home answered: a round they held may then be planned in the same sweep.
func (*Provider) Settle ¶
Settle writes, after the steps, what planning leaves behind: the fingerprint a review stored without its head gets, the first round skip a review workspace clears, and the first rounds' block and unblock events. st is the sweep's round state; Settle edits it and the sweep saves it.
type RoundState ¶
type RoundState interface {
automation.State
Rounds() *round.Store
}
RoundState is the sweep's round state as Settle receives it.
type Store ¶
type Store interface {
Overrides(ctx context.Context) (map[pr.Ref]dinv.Override, error)
// FirstRoundBlocks maps each unit whose round is blocked to its
// round_blocked event.
FirstRoundBlocks(ctx context.Context) (map[unit.Unit]port.Event, error)
EventsByPR(ctx context.Context, refs []pr.Ref) (map[pr.Ref][]dinv.Event, error)
RecordEvent(ctx context.Context, ev dinv.Event) error
}
Store is what the facts read of the inventory besides the planning inputs, and the events Refresh and Settle record.