server

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 24 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 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,
) (*Server, error)

New returns a new instance of Server.

func (*Server) ExitCode

func (s *Server) ExitCode(runError error) int

ExitCode returns an exit code for a given error.

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
}

func ProvideTestEnv

func ProvideTestEnv(server *Server, store *sqlstore.SQLStore, ns *notifications.NotificationServiceMock) (*TestEnv, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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