-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
job_stats_mgr.go
82 lines (69 loc) · 2.19 KB
/
job_stats_mgr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2018 The Harbor Authors. All rights reserved.
package opm
import "github.com/vmware/harbor/src/jobservice/models"
//JobStatsManager defines the methods to handle stats of job.
type JobStatsManager interface {
//Start to serve
Start()
//Shutdown the manager
Shutdown()
//Save the job stats
//Async method to retry and improve performance
//
//jobStats models.JobStats : the job stats to be saved
Save(jobStats models.JobStats)
//Get the job stats from backend store
//Sync method as we need the data
//
//Returns:
// models.JobStats : job stats data
// error : error if meet any problems
Retrieve(jobID string) (models.JobStats, error)
//SetJobStatus will mark the status of job to the specified one
//Async method to retry
SetJobStatus(jobID string, status string)
//Send command fro the specified job
//
//jobID string : ID of the being retried job
//command string : the command applied to the job like stop/cancel
//
//Returns:
// error if it was not successfully sent
SendCommand(jobID s