Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2629)

Unified Diff: build_scheduler/go/task_scheduler/cache_wrapper.go

Issue 2296763008: [task scheduler] Move files from build_scheduler/ to task_scheduler/ (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build_scheduler/go/parse_task_cfg/main.go ('k') | build_scheduler/go/task_scheduler/perftest/perftest.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build_scheduler/go/task_scheduler/cache_wrapper.go
diff --git a/build_scheduler/go/task_scheduler/cache_wrapper.go b/build_scheduler/go/task_scheduler/cache_wrapper.go
deleted file mode 100644
index 2d3506031cd5902ac17f0dd93b4600c180f6d080..0000000000000000000000000000000000000000
--- a/build_scheduler/go/task_scheduler/cache_wrapper.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package task_scheduler
-
-import (
- "fmt"
-
- "go.skia.org/infra/build_scheduler/go/db"
-)
-
-// cacheWrapper is an implementation of db.TaskCache which allows insertion of
-// fake Tasks. Use one per task spec.
-type cacheWrapper struct {
- byCommit map[string]*db.Task
- byId map[string]*db.Task
- c db.TaskCache
- known bool
-}
-
-func newCacheWrapper(c db.TaskCache) *cacheWrapper {
- return &cacheWrapper{
- byCommit: map[string]*db.Task{},
- byId: map[string]*db.Task{},
- c: c,
- known: false,
- }
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) GetTask(id string) (*db.Task, error) {
- if t, ok := c.byId[id]; ok {
- return t, nil
- }
- return c.c.GetTask(id)
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) GetTaskForCommit(repo, commit, name string) (*db.Task, error) {
- if t, ok := c.byCommit[commit]; ok {
- return t, nil
- }
- return c.c.GetTaskForCommit(repo, commit, name)
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) GetTasksForCommits(string, []string) (map[string]map[string]*db.Task, error) {
- return nil, fmt.Errorf("cacheWrapper.GetTasksForCommits not implemented.")
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) KnownTaskName(repo, name string) bool {
- if c.known {
- return true
- }
- return c.c.KnownTaskName(repo, name)
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) UnfinishedTasks() ([]*db.Task, error) {
- return nil, fmt.Errorf("cacheWrapper.UnfinishedTasks not implemented.")
-}
-
-// See documentation for TaskCache interface.
-func (c *cacheWrapper) Update() error {
- return fmt.Errorf("cacheWrapper.Update not implemented.")
-}
-
-// insert adds a task to the cacheWrapper's fake layer so that it will be
-// included in query results but not actually inserted into the DB.
-func (c *cacheWrapper) insert(t *db.Task) {
- c.byId[t.Id] = t
- for _, commit := range t.Commits {
- c.byCommit[commit] = t
- }
- c.known = true
-}
« no previous file with comments | « build_scheduler/go/parse_task_cfg/main.go ('k') | build_scheduler/go/task_scheduler/perftest/perftest.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698