service

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 26 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(ctx context.Context, 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