Documentation
¶
Index ¶
- func Run[C Config](getConfig func() (C, error), ...)
- type App
- func (a *App) GetHTTPServeMux() *http.ServeMux
- func (a *App) GetMetricsRegistry() *prometheus.Registry
- func (a *App) RegisterCleanup(cleanup func() error)
- func (a *App) RegisterGRPC(register func(*grpc.Server))
- func (a *App) RegisterHealthProbe(ctx context.Context, name string, probe ps_healthcheck.Probe)
- func (a *App) RegisterWorker(done <-chan struct{})
- type Config
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 (*App) GetMetricsRegistry ¶
func (a *App) GetMetricsRegistry() *prometheus.Registry
func (*App) RegisterCleanup ¶
RegisterCleanup registers dependency cleanup in reverse registration order, after graceful completion or cancellation of active work.
func (*App) RegisterGRPC ¶
RegisterGRPC registers application services before the gRPC listener starts.
func (*App) RegisterHealthProbe ¶
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.