service

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExternalServiceList

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

ExternalServiceList holds the initialiser and initialisation state of external services.

func NewServiceList

func NewServiceList(cfg *config.Config, buildTime, gitCommit, version string, router *mux.Router) (*ExternalServiceList, error)

NewServiceList creates a new service list of dependent services with the provided initialiser

func (*ExternalServiceList) GetAuthMiddleware

func (e *ExternalServiceList) GetAuthMiddleware() auth.Middleware

func (*ExternalServiceList) GetClock

func (e *ExternalServiceList) GetClock() clock.Clock

func (*ExternalServiceList) GetHTTPServer

func (e *ExternalServiceList) GetHTTPServer() files.HTTPServer

func (*ExternalServiceList) GetHealthCheck

func (e *ExternalServiceList) GetHealthCheck() health.Checker

func (*ExternalServiceList) GetKafkaProducer

func (e *ExternalServiceList) GetKafkaProducer() kafka.IProducer

func (*ExternalServiceList) GetMongoDB

func (e *ExternalServiceList) GetMongoDB() mongo.Client

func (*ExternalServiceList) GetS3Clienter added in v1.3.0

func (e *ExternalServiceList) GetS3Clienter() aws.S3Clienter

func (*ExternalServiceList) Shutdown

func (e *ExternalServiceList) Shutdown(ctx context.Context) error

type OurProducer

type OurProducer interface {
	kafka.IProducer
}

type Service

type Service struct {
	Server         files.HTTPServer
	Router         *mux.Router
	ServiceList    ServiceContainer
	HealthCheck    health.Checker
	MongoClient    mongo.Client
	KafkaProducer  kafka.IProducer
	AuthMiddleware auth.Middleware
	S3Client       aws.S3Clienter
}

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

func Run

func Run(ctx context.Context, serviceList ServiceContainer, svcErrors chan error, cfg *config.Config, r *mux.Router) (*Service, error)

Run the service

func (*Service) Close

func (svc *Service) Close(ctx context.Context, timeout time.Duration) error

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

type ServiceContainer

type ServiceContainer interface {
	GetHTTPServer() files.HTTPServer
	GetHealthCheck() health.Checker
	GetMongoDB() mongo.Client
	GetClock() clock.Clock
	GetKafkaProducer() kafka.IProducer
	GetAuthMiddleware() auth.Middleware
	GetS3Clienter() aws.S3Clienter
	Shutdown(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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