OLD | NEW |
1 package task_scheduler | 1 package scheduling |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 | 5 |
6 » "go.skia.org/infra/build_scheduler/go/db" | 6 » "go.skia.org/infra/task_scheduler/go/db" |
7 ) | 7 ) |
8 | 8 |
9 // cacheWrapper is an implementation of db.TaskCache which allows insertion of | 9 // cacheWrapper is an implementation of db.TaskCache which allows insertion of |
10 // fake Tasks. Use one per task spec. | 10 // fake Tasks. Use one per task spec. |
11 type cacheWrapper struct { | 11 type cacheWrapper struct { |
12 byCommit map[string]*db.Task | 12 byCommit map[string]*db.Task |
13 byId map[string]*db.Task | 13 byId map[string]*db.Task |
14 c db.TaskCache | 14 c db.TaskCache |
15 known bool | 15 known bool |
16 } | 16 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // insert adds a task to the cacheWrapper's fake layer so that it will be | 66 // insert adds a task to the cacheWrapper's fake layer so that it will be |
67 // included in query results but not actually inserted into the DB. | 67 // included in query results but not actually inserted into the DB. |
68 func (c *cacheWrapper) insert(t *db.Task) { | 68 func (c *cacheWrapper) insert(t *db.Task) { |
69 c.byId[t.Id] = t | 69 c.byId[t.Id] = t |
70 for _, commit := range t.Commits { | 70 for _, commit := range t.Commits { |
71 c.byCommit[commit] = t | 71 c.byCommit[commit] = t |
72 } | 72 } |
73 c.known = true | 73 c.known = true |
74 } | 74 } |
OLD | NEW |