ps_bootstrap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run[C Config](getConfig func() (C, error), setup func(context.Context, context.Context, C, *App) error)

Run owns the common lifecycle. setup registers handlers and probes before either listener starts. setup receives a work context, canceled after handlers finish or their grace period expires, and a draining context, canceled as soon as shutdown starts to stop background workers from taking new work.

Types

type App

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

func (*App) GetHTTPServeMux

func (a *App) GetHTTPServeMux() *http.ServeMux

func (*App) GetMetricsRegistry

func (a *App) GetMetricsRegistry() *prometheus.Registry

func (*App) RegisterCleanup

func (a *App) RegisterCleanup(cleanup func() error)

RegisterCleanup registers dependency cleanup in reverse registration order, after graceful completion or cancellation of active work.

func (*App) RegisterGRPC

func (a *App) RegisterGRPC(register func(*grpc.Server))

RegisterGRPC registers application services before the gRPC listener starts.

func (*App) RegisterHealthProbe

func (a *App) RegisterHealthProbe(ctx context.Context, name string, probe ps_healthcheck.Probe)

func (*App) RegisterWorker

func (a *App) RegisterWorker(done <-chan struct{})

RegisterWorker tracks a background worker separately from dependency cleanup. done must close after the worker and its active handlers have finished.

type Config

type Config interface {
	GetLogPreset() logger.Preset
	GetServiceName() string
	GetHTTPListenAddr() string
	GetGRPCListenAddr() string
}

Jump to

Keyboard shortcuts

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