server

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	HomePath    string
	PidFile     string
	Version     string
	Commit      string
	BuildBranch string
	Listener    net.Listener
}

Options contains parameters for the New function.

type Runner

type Runner struct {
	Cfg               *setting.Cfg
	SQLStore          db.DB
	SettingsProvider  setting.Provider
	Features          featuremgmt.FeatureToggles
	EncryptionService encryption.Internal
	SecretsService    *manager.SecretsService
	SecretsMigrator   secrets.Migrator
	UserService       user.Service
}

func NewRunner

func NewRunner(cfg *setting.Cfg, sqlStore db.DB, settingsProvider setting.Provider,
	encryptionService encryption.Internal, features featuremgmt.FeatureToggles,
	secretsService *manager.SecretsService, secretsMigrator secrets.Migrator,
	userService user.Service,
) Runner

type Server

type Server struct {
	HTTPServer *api.HTTPServer
	// contains filtered or unexported fields
}

Server is responsible for managing the lifecycle of services.

func New

func New(opts Options, cfg *setting.Cfg, httpServer *api.HTTPServer, roleRegistry accesscontrol.RoleRegistry,
	provisioningService provisioning.ProvisioningService, backgroundServiceProvider registry.BackgroundServiceRegistry,
	usageStatsProvidersRegistry registry.UsageStatsProvidersRegistry, statsCollectorService *statscollector.Service,
	moduleService modules.Engine,
) (*Server, error)

New returns a new instance of Server.

func (*Server) Run

func (s *Server) Run() error

Run initializes and starts services. This will block until all services have exited. To initiate shutdown, call the Shutdown method in another goroutine.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context, reason string) error

Shutdown initiates Grafana graceful shutdown. This shuts down all running background services. Since Run blocks Shutdown supposed to be run from a separate goroutine.

type TestEnv

type TestEnv struct {
	Server              *Server
	SQLStore            *sqlstore.SQLStore
	NotificationService *notifications.NotificationServiceMock
	GRPCServer          grpcserver.Provider
	PluginRegistry      registry.Service
	HTTPClientProvider  httpclient.Provider
	OAuthTokenService   *oauthtokentest.Service
}

func ProvideTestEnv

func ProvideTestEnv(
	server *Server,
	store *sqlstore.SQLStore,
	ns *notifications.NotificationServiceMock,
	grpcServer grpcserver.Provider,
	pluginRegistry registry.Service,
	httpClientProvider httpclient.Provider,
	oAuthTokenService *oauthtokentest.Service,
) (*TestEnv, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL