2022-02-22 01:47:42 -06:00
|
|
|
package comments
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-12 11:30:50 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
2022-02-22 01:47:42 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/comments/commentmodel"
|
|
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
|
|
|
"github.com/grafana/grafana/pkg/services/live"
|
|
|
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Service struct {
|
|
|
|
cfg *setting.Cfg
|
|
|
|
live *live.GrafanaLive
|
|
|
|
sqlStore *sqlstore.SQLStore
|
|
|
|
storage Storage
|
|
|
|
permissions *commentmodel.PermissionChecker
|
|
|
|
}
|
|
|
|
|
2022-04-12 11:30:50 -05:00
|
|
|
func ProvideService(cfg *setting.Cfg, store *sqlstore.SQLStore, live *live.GrafanaLive, features featuremgmt.FeatureToggles, accessControl accesscontrol.AccessControl) *Service {
|
2022-02-22 01:47:42 -06:00
|
|
|
s := &Service{
|
|
|
|
cfg: cfg,
|
|
|
|
live: live,
|
|
|
|
sqlStore: store,
|
|
|
|
storage: &sqlStorage{
|
|
|
|
sql: store,
|
|
|
|
},
|
2022-04-12 11:30:50 -05:00
|
|
|
permissions: commentmodel.NewPermissionChecker(store, features, accessControl),
|
2022-02-22 01:47:42 -06:00
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run Service.
|
|
|
|
func (s *Service) Run(ctx context.Context) error {
|
|
|
|
<-ctx.Done()
|
|
|
|
return ctx.Err()
|
|
|
|
}
|