Adding the summary to the Job Stub

This commit is contained in:
Diptanu Choudhury
2016-07-21 13:21:47 -07:00
parent 7628283c78
commit 0a7489ddfc
2 changed files with 5 additions and 2 deletions

View File

@@ -368,7 +368,8 @@ func (j *Job) List(args *structs.JobListRequest,
break
}
job := raw.(*structs.Job)
jobs = append(jobs, job.Stub())
summary, _ := snap.JobSummaryByID(job.ID)
jobs = append(jobs, job.Stub(summary))
}
reply.Jobs = jobs

View File

@@ -1195,7 +1195,7 @@ func (j *Job) LookupTaskGroup(name string) *TaskGroup {
}
// Stub is used to return a summary of the job
func (j *Job) Stub() *JobListStub {
func (j *Job) Stub(summary *JobSummary) *JobListStub {
return &JobListStub{
ID: j.ID,
ParentID: j.ParentID,
@@ -1207,6 +1207,7 @@ func (j *Job) Stub() *JobListStub {
CreateIndex: j.CreateIndex,
ModifyIndex: j.ModifyIndex,
JobModifyIndex: j.JobModifyIndex,
JobSummary: summary,
}
}
@@ -1228,6 +1229,7 @@ type JobListStub struct {
CreateIndex uint64
ModifyIndex uint64
JobModifyIndex uint64
JobSummary *JobSummary
}
// UpdateStrategy is used to modify how updates are done