Files
mattermost/jobs/server.go
Jesús Espino a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00

59 lines
1.6 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
ejobs "github.com/mattermost/mattermost-server/v5/einterfaces/jobs"
tjobs "github.com/mattermost/mattermost-server/v5/jobs/interfaces"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/services/configservice"
"github.com/mattermost/mattermost-server/v5/store"
)
type JobServer struct {
ConfigService configservice.ConfigService
Store store.Store
Workers *Workers
Schedulers *Schedulers
DataRetentionJob ejobs.DataRetentionJobInterface
MessageExportJob ejobs.MessageExportJobInterface
ElasticsearchAggregator ejobs.ElasticsearchAggregatorInterface
ElasticsearchIndexer ejobs.ElasticsearchIndexerInterface
LdapSync ejobs.LdapSyncInterface
Migrations tjobs.MigrationsJobInterface
Plugins tjobs.PluginsJobInterface
}
func NewJobServer(configService configservice.ConfigService, store store.Store) *JobServer {
return &JobServer{
ConfigService: configService,
Store: store,
}
}
func (srv *JobServer) Config() *model.Config {
return srv.ConfigService.Config()
}
func (srv *JobServer) StartWorkers() {
srv.Workers = srv.Workers.Start()
}
func (srv *JobServer) StartSchedulers() {
srv.Schedulers = srv.Schedulers.Start()
}
func (srv *JobServer) StopWorkers() {
if srv.Workers != nil {
srv.Workers.Stop()
}
}
func (srv *JobServer) StopSchedulers() {
if srv.Schedulers != nil {
srv.Schedulers.Stop()
}
}