servicerunner

package
v0.0.0-...-fc0fd33 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IfNot

func IfNot[T any](exclude bool, opt func(*runnerCfg[T])) func(*runnerCfg[T])

func OnInit

func OnInit[T any](initFunc func(context.Context, *T) error) func(*runnerCfg[T])

func OnMuxInit

func OnMuxInit[T any](initFunc func(ctx context.Context, identifier, port string, svcCfg *T, handler *http.ServeMux) error) func(*muxCfg[T])

func OnRunning

func OnRunning[T any](runningFunc func(context.Context, *T) error) func(*runnerCfg[T])

func OnShutdown

func OnShutdown[T any](shutdownFunc func(context.Context, *T) error) func(*runnerCfg[T])

func OnStarting

func OnStarting[T any](startupFunc func(context.Context, *T) error) func(*runnerCfg[T])

func WithHTTPServeMux

func WithHTTPServeMux[T any](identifer string, opts ...func(*muxCfg[T])) func(*runnerCfg[T])

func WithInitTimeout

func WithInitTimeout[T any](timeout time.Duration) func(*runnerCfg[T])

func WithK8SLivenessProbe

func WithK8SLivenessProbe[T any](isAlive func() error) func(*muxCfg[T])

func WithK8SReadinessProbes

func WithK8SReadinessProbes[T any](probers map[string]handlers.ServiceProber) func(*muxCfg[T])

func WithListenAddr

func WithListenAddr[T any](listen string) func(*muxCfg[T])

func WithPPROF

func WithPPROF[T any]() func(*muxCfg[T])

func WithPort

func WithPort[T any](port string) func(*muxCfg[T])

func WithRunningTimeout

func WithRunningTimeout[T any](tmo time.Duration) func(*runnerCfg[T])

func WithShutdownTimeout

func WithShutdownTimeout[T any](tmo time.Duration) func(*runnerCfg[T])

func WithStartingTimeout

func WithStartingTimeout[T any](tmo time.Duration) func(*runnerCfg[T])

func WithTerminationTimeout

func WithTerminationTimeout[T any](tmo time.Duration) func(*runOpts[T])

func WithWorker

func WithWorker[T any](worker func(context.Context, *T) error) func(*runOpts[T])

Types

type Runner

type Runner[T any] interface {
	Run(ctx context.Context, options ...func(*runOpts[T])) error
}

func New

func New[T any](ctx context.Context, svcCfg T, opts ...func(cfg *runnerCfg[T])) (context.Context, Runner[T])

Jump to

Keyboard shortcuts

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