mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 19:00:54 -06:00
05709ce411
* chore: add alias for InitTestDB and Session Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store. * next pass of removing sqlstore imports * last little bit * remove mockstore where possible
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package comments
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/db"
|
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
"github.com/grafana/grafana/pkg/services/annotations"
|
|
"github.com/grafana/grafana/pkg/services/comments/commentmodel"
|
|
"github.com/grafana/grafana/pkg/services/dashboards"
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
|
"github.com/grafana/grafana/pkg/services/live"
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
type Service struct {
|
|
cfg *setting.Cfg
|
|
live *live.GrafanaLive
|
|
sqlStore db.DB
|
|
storage Storage
|
|
permissions *commentmodel.PermissionChecker
|
|
userService user.Service
|
|
}
|
|
|
|
func ProvideService(cfg *setting.Cfg, store db.DB, live *live.GrafanaLive,
|
|
features featuremgmt.FeatureToggles, accessControl accesscontrol.AccessControl,
|
|
dashboardService dashboards.DashboardService, userService user.Service, annotationsRepo annotations.Repository) *Service {
|
|
s := &Service{
|
|
cfg: cfg,
|
|
live: live,
|
|
sqlStore: store,
|
|
storage: &sqlStorage{
|
|
sql: store,
|
|
},
|
|
permissions: commentmodel.NewPermissionChecker(store, features, accessControl, dashboardService, annotationsRepo),
|
|
userService: userService,
|
|
}
|
|
return s
|
|
}
|
|
|
|
// Run Service.
|
|
func (s *Service) Run(ctx context.Context) error {
|
|
<-ctx.Done()
|
|
return ctx.Err()
|
|
}
|