server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InitFailedErrorMessage        = "server init. failed"
	MetricsInitFailedErrorMessage = "failed to init. prometheus metrics"
)

Error messages used for server and metrics initialization.

Functions

This section is empty.

Types

type Http

type Http interface {
	Start()
	IsAlive() bool
}

Http interface exposes methods for starting and liveness probing.

type HttpServer

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

HttpServer implements Http, wraps all dependencies required for running the HTTP server.

func New

func New(
	ctx context.Context,
	cfg *config.Config,
	cache storage.Storage,
	seoRepo repository.Seo,
	reader synced.PooledReader,
	probe liveness.Prober,
) (*HttpServer, error)

New creates a new HttpServer, initializing metrics and the HTTP server itself. If any step fails, returns an error and performs cleanup.

func (*HttpServer) IsAlive

func (s *HttpServer) IsAlive() bool

IsAlive returns true if the server is marked as alive.

func (*HttpServer) Start

func (s *HttpServer) Start()

Start runs the HTTP server in a goroutine and waits for it to finish.

Jump to

Keyboard shortcuts

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