Move HTTPService and ConfigService into services package (#9422)

* Move HTTPService and ConfigService into utils package

* Re-add StaticConfigService

* Move config and http services into their own packages
Этот коммит содержится в:
Harrison Healey
2018-09-26 12:42:51 -04:00
коммит произвёл GitHub
родитель 15d64fb201
Коммит 4e59a27293
11 изменённых файлов: 147 добавлений и 110 удалений

Просмотреть файл

@@ -7,25 +7,12 @@ import (
ejobs "github.com/mattermost/mattermost-server/einterfaces/jobs"
tjobs "github.com/mattermost/mattermost-server/jobs/interfaces"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/services/configservice"
"github.com/mattermost/mattermost-server/store"
)
type ConfigService interface {
Config() *model.Config
AddConfigListener(func(old, current *model.Config)) string
RemoveConfigListener(string)
}
type StaticConfigService struct {
Cfg *model.Config
}
func (s StaticConfigService) Config() *model.Config { return s.Cfg }
func (StaticConfigService) AddConfigListener(func(old, current *model.Config)) string { return "" }
func (StaticConfigService) RemoveConfigListener(string) {}
type JobServer struct {
ConfigService ConfigService
ConfigService configservice.ConfigService
Store store.Store
Workers *Workers
Schedulers *Schedulers
@@ -38,7 +25,7 @@ type JobServer struct {
Migrations tjobs.MigrationsJobInterface
}
func NewJobServer(configService ConfigService, store store.Store) *JobServer {
func NewJobServer(configService configservice.ConfigService, store store.Store) *JobServer {
return &JobServer{
ConfigService: configService,
Store: store,

Просмотреть файл

@@ -8,11 +8,12 @@ import (
"github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/services/configservice"
)
type Workers struct {
startOnce sync.Once
ConfigService ConfigService
ConfigService configservice.ConfigService
Watcher *Watcher
DataRetention model.Worker