Documentation
¶
Index ¶
- func Liveness() http.HandlerFunc
- func NewCronComponent(cron *gocron.Scheduler) *cronComponent
- func NewHealthzComponent(providers []Provider, config config.HealthzConfig) *healthzComponent
- func NewLifecycleComponent(startups []LifeCycleFunc, run LifeCycleFunc, cleanups []LifeCycleFunc) *lifecycleComponent
- func NewMetriczComponent(registry *prometheus.Registry, config config.MetricszConfig) *metriczComponent
- func WithHttpServer(httpServer *http.Server) httpComponentOption
- func WithServerConfig(serverConfig *config.ServerConfig) httpComponentOption
- type Application
- type Checkable
- type CheckableFunc
- type Component
- type Error
- type HealthzChecker
- type HealthzResponse
- type Hook
- type HookType
- type HttpComponent
- type LifeCycleFunc
- type Logger
- type Provider
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Liveness ¶
func Liveness() http.HandlerFunc
func NewCronComponent ¶
func NewHealthzComponent ¶
func NewHealthzComponent(providers []Provider, config config.HealthzConfig) *healthzComponent
func NewLifecycleComponent ¶
func NewLifecycleComponent(startups []LifeCycleFunc, run LifeCycleFunc, cleanups []LifeCycleFunc) *lifecycleComponent
func NewMetriczComponent ¶
func NewMetriczComponent(registry *prometheus.Registry, config config.MetricszConfig) *metriczComponent
func WithHttpServer ¶
func WithServerConfig ¶
func WithServerConfig(serverConfig *config.ServerConfig) httpComponentOption
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplications ¶
func NewApplications(components ...Component) *Application
func (*Application) AddComponent ¶
func (app *Application) AddComponent(c Component)
func (*Application) Run ¶
func (app *Application) Run() error
func (Application) WithLogger ¶
func (app Application) WithLogger(logger Logger) Application
func (Application) WithTimeout ¶
func (app Application) WithTimeout(timeout time.Duration) Application
type CheckableFunc ¶
type Component ¶
type Component interface { // Synchronous startup, container runs this one by one Startup() error // Asynchronous run, container runs this in parrallel // Has to block until it's done // When one of componenst exits this func, container will start shutting down Run() error // Cleanup function Close(ctx context.Context) error // Retrieve hook functions Hooks() []Hook }
type HealthzChecker ¶
type HealthzChecker struct {
Providers []Provider
}
HealthzChecker contains the instance
func NewHealthChecker ¶
func NewHealthChecker(providers []Provider) *HealthzChecker
func (*HealthzChecker) Healthz ¶
func (h *HealthzChecker) Healthz() http.HandlerFunc
returns a http.HandlerFunc for the healthz service
func (*HealthzChecker) Serve ¶
func (h *HealthzChecker) Serve(config config.HealthzConfig) *http.Server
type HealthzResponse ¶
type HealthzResponse struct { Services []Service `json:"services,omitempty"` Healthy bool `json:"healthy"` }
Response type, we return a json object with {healthy:bool, errors:[]}
type HttpComponent ¶
type HttpComponent struct {
// contains filtered or unexported fields
}
func NewHttpComponent ¶
func NewHttpComponent(handler http.Handler, options ...httpComponentOption) *HttpComponent
func (*HttpComponent) GetHandler ¶
func (hc *HttpComponent) GetHandler(t testing.TB) http.Handler
This is just for testing
func (*HttpComponent) Hooks ¶
func (hc *HttpComponent) Hooks() []Hook
func (*HttpComponent) Run ¶
func (hc *HttpComponent) Run() error
func (*HttpComponent) Startup ¶
func (hc *HttpComponent) Startup() error
type LifeCycleFunc ¶
Click to show internal directories.
Click to hide internal directories.