Documentation
¶
Overview ¶
Package summary counts the pull requests opened, merged and closed over a window, from the open listings and from the pull requests it keeps in SQLite, which it brings up to date by reading what changed since its last read, and back to a window's start where the store does not reach it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileFor ¶
func FileFor(dir string, scope pullrequests.Scope) string
FileFor is the store's file in dir for a scope: a name digested from its repos and owners, so two scopes never share rows, and an edit to the registry starts a file of its own.
Types ¶
type Coverage ¶
Coverage is how far the store reaches. It holds every pull request in the scope last updated at or after From, each as it stood at Synced or later, and so every one merged or closed since From.
type KindValues ¶
type KindValues struct {
All *float64 `json:"all"`
People *float64 `json:"people"`
Bots *float64 `json:"bots"`
}
KindValues is a measure over pull requests, whoever opened them, then by author kind, each null where no pull request of that kind gives one.
type Kinds ¶
Kinds is a count of pull requests, whoever opened them, then split by whether a person or an app did. One whose author is gone counts as a person's.
type MergeBucket ¶
type MergeBucket struct {
Label string `json:"label"`
FromSeconds float64 `json:"from_seconds"`
ToSeconds *float64 `json:"to_seconds"`
Merged Kinds `json:"merged"`
}
MergeBucket is the merges that took from FromSeconds up to ToSeconds to land, from opening, with no ToSeconds on the last.
type Numbers ¶
type Numbers struct {
Window string `json:"window"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
// Open is the pull requests open at Until, and Opened those opened within the window,
// whether open or closed now.
Open Kinds `json:"open"`
Opened Kinds `json:"opened"`
Merged Kinds `json:"merged"`
ClosedUnmerged Kinds `json:"closed_unmerged"`
// The times to merge run from opening to merging, over the merges within the window.
MedianSecondsToMerge KindValues `json:"median_seconds_to_merge"`
P90SecondsToMerge KindValues `json:"p90_seconds_to_merge"`
// ReviewedByRound is the merges whose first review was a review round's, and
// ReviewedByRoundShare that as a share of the merges, from 0 to 1.
ReviewedByRound Kinds `json:"merged_reviewed_by_round"`
// Repos is each repo with a merge within the window, the most merges first.
Repos []RepoMerges `json:"repos"`
TimeToMerge []MergeBucket `json:"time_to_merge"`
// MergedPer is hour or day, the span each of MergedOver counts, and MergedOver runs from
// the period holding Since to the one holding Until, a day starting at local midnight.
MergedPer string `json:"merged_per"`
MergedOver []PeriodMerges `json:"merged_over"`
// OpenOver is the open pull requests at about openSamples instants from Since to Until, a
// whole number of hours apart, and at Until.
OpenOver []OpenAt `json:"open_over"`
}
Numbers is what the Summary tab and prs summary show for one window.
func Count ¶
func Count(window Window, kept []pullrequests.HistoryRecord, open []pullrequests.PullRequest, loc *time.Location) Numbers
Count is the numbers for the window, from the merged and closed pull requests in kept and the open ones in open. Where both hold a pull request, the record updated last stands, as on the board. GitHub's open search still finds one for a while after it merges, with the record it read before the merge, and one reopened since the store read it is newer in open. A record in open counts only while it stands open. Days start at midnight in loc.
type PeriodMerges ¶
PeriodMerges is the merges within the hour or the day starting at Start.
type RepoMerges ¶
type RepoMerges struct {
Slug string `json:"slug"`
Merged Kinds `json:"merged"`
// MedianSecondsToMerge is from opening to merging, across the repo's merges.
MedianSecondsToMerge float64 `json:"median_seconds_to_merge"`
}
RepoMerges is one repo's merges within the window.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the pull requests one scope's repos hold, and how far back and how lately they were read.
func Open ¶
Open opens the store at path, making its directory and tables where they are missing. An empty path keeps the store in memory, for a run with nowhere to cache it.
func (*Store) Closed ¶
func (s *Store) Closed(since time.Time) ([]pullrequests.HistoryRecord, error)
Closed is every pull request the store holds merged or closed at or after since, the newest first.
func (*Store) Coverage ¶
Coverage is how far the store reaches, and false where nothing has been read into it.
func (*Store) Keep ¶
func (s *Store) Keep(records []pullrequests.HistoryRecord, coverage Coverage) error
Keep writes each record over any row it had that was updated no later, and the coverage, as one transaction, so the coverage never claims a read whose rows did not land. A board and a prs summary can sync one file at once, so the coverage only widens: the earliest From and the latest Synced stand. Each read asks for every update since a From older than any sync's start, so the later sync read every change since the earlier one began.