+type JobInfo struct {
+ Owner string `json:"owner"`
+ LastUpdated string `json:"last_updated"`
+ InfoJobIdentity string `json:"info_job_identity"`
+ TargetUri string `json:"target_uri"`
+ InfoJobData string `json:"info_job_data"`
+ InfoTypeIdentity string `json:"info_type_identity"`
+}
+
+type JobHandler interface {
+ AddJob(JobInfo) error
+}
+
+var (
+ typeDir = "configs"
+ Handler JobHandler
+ allJobs = make(map[string]map[string]JobInfo)
+)
+
+func init() {
+ Handler = newJobHandlerImpl()
+}
+
+type jobHandlerImpl struct{}
+
+func newJobHandlerImpl() *jobHandlerImpl {
+ return &jobHandlerImpl{}
+}
+
+func (jh *jobHandlerImpl) AddJob(ji JobInfo) error {
+ if jobs, ok := allJobs[ji.InfoTypeIdentity]; ok {
+ if _, ok := jobs[ji.InfoJobIdentity]; ok {
+ // TODO: Update job
+ } else {
+ jobs[ji.InfoJobIdentity] = ji
+ }
+ }
+ return nil
+}