-type jobHandlerImpl struct{}
-
-func newJobHandlerImpl() *jobHandlerImpl {
- return &jobHandlerImpl{}
+type JobsManager interface {
+ AddJob(JobInfo) error
+ DeleteJob(jobId string)
+}
+
+type JobsManagerImpl struct {
+ configFile string
+ allTypes map[string]TypeData
+ pollClient restclient.HTTPClient
+ mrAddress string
+ distributeClient restclient.HTTPClient
+}
+
+type jobHandler struct {
+ mu sync.Mutex
+ typeId string
+ topicUrl string
+ jobs map[string]JobInfo
+ addJobCh chan JobInfo
+ deleteJobCh chan string
+ pollClient restclient.HTTPClient
+ distributeClient restclient.HTTPClient
+}
+
+func NewJobsManagerImpl(typeConfigFilePath string, pollClient restclient.HTTPClient, mrAddr string, distributeClient restclient.HTTPClient) *JobsManagerImpl {
+ return &JobsManagerImpl{
+ configFile: typeConfigFilePath,
+ allTypes: make(map[string]TypeData),
+ pollClient: pollClient,
+ mrAddress: mrAddr,
+ distributeClient: distributeClient,
+ }