| 1 | package jobs |
| 2 | |
| 3 | // jobClock is a job's liveness timeline: unix-millisecond stamps advanced as the |
| 4 | // job runs, plus the latch the stalled warning sets once activityAt goes quiet. |
| 5 | // Grouping the latch with the stamp it derives from stops the two from |
| 6 | // describing different jobs, and keeps Job from listing every scalar flat. |
| 7 | // Guarded by Job.mu; this type takes no lock of its own. |
| 8 | type jobClock struct { |
| 9 | startedAt int64 |
| 10 | finishedAt int64 |
| 11 | activityAt int64 |
| 12 | stalled bool |
| 13 | } |
| 14 | |
| 15 | // jobOutcome is what the run function left behind: its text, whether the run |
| 16 | // returned at all, and whether Output already surfaced the text. All three are |
| 17 | // written once as the job terminates and read together afterwards. Guarded by |
| 18 | // Job.mu. |
| 19 | type jobOutcome struct { |
| 20 | text string |
| 21 | returned bool |
| 22 | read bool // text already surfaced by Output (task jobs stream nothing to the tail) |
| 23 | } |
| 24 |