Documentation
¶
Overview ¶
Package present is the GitHub plugin's source logic the daemon reaches through Action and View: the user's mutes, the rows of pull requests the read model does not list, the detail, the checks, Explore and the timings; and its bookkeeping on each snapshot of the rows.
Index ¶
Constants ¶
const ( ViewExplore = "explore" ViewExploreRecent = "explore.recent" )
The views the plugin serves besides the daemon's unit views.
const ( ActionMute = "mute" ActionUnmute = "unmute" ActionNudgePrepare = "nudge.prepare" )
The actions the plugin runs.
const FailureDays = 14
FailureDays is how long after a merge a fix or a revert of the same files counts as that change failing.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BriefQueue ¶
type BriefQueue struct{ Q Queue }
BriefQueue is a brief queue keyed by unit, as the daemon runs it; a unit that is no pull request has no brief.
func (BriefQueue) Due ¶
func (b BriefQueue) Due() <-chan struct{}
func (BriefQueue) Touched ¶
func (b BriefQueue) Touched(units []unit.Unit)
type Briefs ¶
type Briefs interface {
Views(ctx context.Context, prs ...dinv.PR) (map[pr.Ref]*brief.View, error)
RefreshIfStale(ctx context.Context, p dinv.PR) error
}
Briefs are the brief queue's views of pull requests.
type Deps ¶
type Deps struct {
Store *inventory.Store
// Reports are what the GitHub plugin last reported of its pull
// requests, which a row derives from.
Reports readmodel.Reports
// Host is the broker: the host's overrides, round state and wakes.
Host src.Host
// Briefs nil shows no brief.
Briefs Briefs
// Mutes are the user's mutes of pull requests, their tasks' wakes;
// nil mutes none.
Mutes readmodel.Mutes
// Plugin runs an action of the running GitHub plugin, which serves the
// nudge's prepare; nil serves none.
Plugin func(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)
// View reads a view of the running GitHub plugin, which searches for
// Explore and reads the failed steps of the checks; nil serves none.
View func(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)
}
Deps are what the presenter reads and writes: the plugin's store, the broker the host serves it, and GitHub.
type Host ¶
type Host struct {
Model *readmodel.Model
Settings func() readmodel.RowSettings
BriefOn bool
Intakes func(ctx context.Context) (map[unit.Unit][]intake.Intake, error)
Books func(ctx context.Context, units ...unit.Unit) (map[unit.Unit]turn.Book, error)
Viewer func(ctx context.Context) (src.Identity, error)
Units *unit.Registry
Now func() time.Time
Logf func(format string, args ...any)
}
Host is what the daemon serves the presenter beside the broker: the rows as its read model derives them.
type Presenter ¶
type Presenter struct {
// contains filtered or unexported fields
}
Presenter is the GitHub plugin's Action, View and bookkeeping.
func (*Presenter) Action ¶
func (p *Presenter) Action(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)
Action runs one of the plugin's actions on a pull request.
func (*Presenter) Keep ¶
Keep is the plugin's bookkeeping on each new snapshot of the rows: the situations that changed.
func (*Presenter) View ¶
func (p *Presenter) View(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)
View serves one of the plugin's views.
type Queue ¶
type Queue interface {
Run(ctx context.Context) (string, error)
Touched(refs []pr.Ref)
Due() <-chan struct{}
Forget(ctx context.Context, ref pr.Ref) error
Attempt(ctx context.Context, ref pr.Ref) (int, error)
}
Queue is the brief queue keyed by pull request.