Documentation ¶
Index ¶
Constants ¶
View Source
const (
// Allocate enough space for this many tasks.
TASKS_INIT_CAPACITY = 60000
)
Variables ¶
This section is empty.
Functions ¶
func GitRepoGetRevisionTimestamp ¶
func GitRepoGetRevisionTimestamp(repos repograph.Map) db.GetRevisionTimestamp
GitRepoGetRevisionTimestamp returns a GetRevisionTimestamp function that gets the revision timestamp from repos, which maps repo name to *repograph.Graph.
Types ¶
type JobCache ¶
type JobCache interface { // GetJob returns the job with the given ID, or an error if no such job exists. GetJob(string) (*types.Job, error) // GetJobMaybeExpired does the same as GetJob but tries to dig into the // DB in case the Job is old enough to have scrolled out of the cache // window. GetJobMaybeExpired(string) (*types.Job, error) // GetJobsByRepoState retrieves all known jobs with the given name at // the given RepoState. Does not search the underlying DB. GetJobsByRepoState(string, types.RepoState) ([]*types.Job, error) // GetMatchingJobsFromDateRange retrieves all jobs which were created // in the given date range and match one of the given job names. GetMatchingJobsFromDateRange(names []string, from time.Time, to time.Time) (map[string][]*types.Job, error) // ScheduledJobsForCommit indicates whether or not we triggered any jobs // for the given repo/commit. ScheduledJobsForCommit(string, string) (bool, error) // UnfinishedJobs returns a list of jobs which were not finished at // the time of the last cache update. UnfinishedJobs() ([]*types.Job, error) // Update loads new jobs from the database. Update() error }
func NewJobCache ¶
func NewJobCache(d db.JobReader, timeWindow *window.Window, getRevisionTimestamp db.GetRevisionTimestamp) (JobCache, error)
NewJobCache returns a local cache which provides more convenient views of job data than the database can provide.
type TaskCache ¶
type TaskCache interface { // GetTask returns the task with the given ID, or an error if no such task exists. GetTask(string) (*types.Task, error) // GetTaskMaybeExpired does the same as GetTask but tries to dig into // the DB in case the Task is old enough to have scrolled out of the // cache window. GetTaskMaybeExpired(string) (*types.Task, error) // GetTaskForCommit retrieves the task with the given name which ran at the // given commit, or nil if no such task exists. GetTaskForCommit(string, string, string) (*types.Task, error) // GetTasksByKey returns the tasks with the given TaskKey, sorted // by creation time. GetTasksByKey(*types.TaskKey) ([]*types.Task, error) // GetTasksForCommits retrieves all tasks which included[1] each of the // given commits. Returns a map whose keys are commit hashes and values are // sub-maps whose keys are task spec names and values are tasks. // // 1) Blamelist calculation is outside the scope of the taskCache, but the // implied assumption here is that there is at most one task for each // task spec which has a given commit in its blamelist. The user is // responsible for inserting tasks into the database so that this invariant // is maintained. Generally, a more recent task will "steal" commits from an // earlier task's blamelist, if the blamelists overlap. There are three // cases to consider: // 1. The newer task ran at a newer commit than the older task. Its // blamelist consists of all commits not covered by the previous task, // and therefore does not overlap with the older task's blamelist. // 2. The newer task ran at the same commit as the older task. Its // blamelist is the same as the previous task's blamelist, and // therefore it "steals" all commits from the previous task, whose // blamelist becomes empty. // 3. The newer task ran at a commit which was in the previous task's // blamelist. Its blamelist consists of the commits in the previous // task's blamelist which it also covered. Those commits move out of // the previous task's blamelist and into the newer task's blamelist. GetTasksForCommits(string, []string) (map[string]map[string]*types.Task, error) // GetTasksFromDateRange retrieves all tasks which were created in the given // date range. GetTasksFromDateRange(from time.Time, to time.Time) ([]*types.Task, error) // KnownTaskName returns true iff the given task name has been seen // before for a non-forced, non-tryjob run. KnownTaskName(string, string) bool // UnfinishedTasks returns a list of tasks which were not finished at // the time of the last cache update. Fake tasks are not included. UnfinishedTasks() ([]*types.Task, error) // Update loads new tasks from the database. Update() error }
func NewTaskCache ¶
NewTaskCache returns a local cache which provides more convenient views of task data than the database can provide.
Click to show internal directories.
Click to hide internal directories.