service

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CantabularClient added in v0.8.0

type CantabularClient interface {
	Checker(context.Context, *healthcheck.CheckState) error
}

type Closer added in v0.5.0

type Closer interface {
	Close(ctx context.Context) error
}

type ExternalServiceList added in v0.3.0

type ExternalServiceList struct {
	Graph       bool
	HealthCheck bool
	HTTPServer  bool
	Init        Initialiser
}

ExternalServiceList holds the initialiser and initialisation state of external services.

func NewServiceList added in v0.3.0

func NewServiceList(initialiser Initialiser) *ExternalServiceList

NewServiceList creates a new service list with the provided initialiser

func (*ExternalServiceList) GetCantabularClient added in v0.8.0

func (e *ExternalServiceList) GetCantabularClient(ctx context.Context, cfg *config.Config) CantabularClient

func (*ExternalServiceList) GetGraphDB added in v0.3.0

func (e *ExternalServiceList) GetGraphDB(ctx context.Context) (api.IGraph, Closer, error)

GetGraphDB creates a graphDB client and sets the Graph flag to true

func (*ExternalServiceList) GetHTTPServer added in v0.3.0

func (e *ExternalServiceList) GetHTTPServer(bindAddr string, httpWriteTimeout time.Duration, router http.Handler) IServer

GetHTTPServer creates an http server and sets the Server flag to true

func (*ExternalServiceList) GetHealthCheck added in v0.3.0

func (e *ExternalServiceList) GetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (IHealthCheck, error)

GetHealthCheck creates a healthcheck with versionInfo and sets teh HealthCheck flag to true

type IHealthCheck added in v0.3.0

type IHealthCheck interface {
	Handler(w http.ResponseWriter, req *http.Request)
	Start(ctx context.Context)
	Stop()
	AddCheck(name string, checker healthcheck.Checker) (err error)
}

IHealthCheck defines the required methods from Healthcheck

type IServer added in v0.3.0

type IServer interface {
	ListenAndServe() error
	Shutdown(ctx context.Context) error
}

IServer defines the required methods from the HTTP server

type Init added in v0.3.0

type Init struct{}

Init implements the Initialiser interface to initialise dependencies

func (*Init) DoGetGraphDB added in v0.3.0

func (e *Init) DoGetGraphDB(ctx context.Context) (api.IGraph, Closer, error)

DoGetGraphDB returns a graphDB

func (*Init) DoGetHTTPServer added in v0.3.0

func (e *Init) DoGetHTTPServer(bindAddr string, httpWriteTimeout time.Duration, router http.Handler) IServer

DoGetHTTPServer creates an HTTP Server with the provided bind address and router

func (*Init) DoGetHealthCheck added in v0.3.0

func (e *Init) DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (IHealthCheck, error)

DoGetHealthCheck creates a healthcheck with versionInfo

type Initialiser added in v0.3.0

type Initialiser interface {
	DoGetHTTPServer(bindAddr string, httpWriteTimeout time.Duration, router http.Handler) IServer
	DoGetGraphDB(ctx context.Context) (api.IGraph, Closer, error)
	DoGetHealthCheck(cfg *config.Config, buildTime, gitCommit, version string) (IHealthCheck, error)
}

Initialiser defines the methods to initialise external services

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service contains all the configs, server and clients to run the observation API

func Run

func Run(ctx context.Context, cfg *config.Config, serviceList *ExternalServiceList, buildTime, gitCommit, version string, svcErrors chan error) (*Service, error)

Run the service with its dependencies

func (*Service) Close

func (svc *Service) Close(ctx context.Context) error

Close gracefully shuts the service down in the required order, with timeout

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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