Documentation
¶
Index ¶
- type Check
- type HandlerMux
- type Server
- func (s *Server) RegisterCheck(name string, checkFn func() (bool, string))
- func (s *Server) RegisterOnMux(mux HandlerMux)
- func (s *Server) SetReady(ready bool)
- func (s *Server) SetReloadFunc(fn func(ctx context.Context) error)
- func (s *Server) SetShutdownFunc(fn func())
- func (s *Server) Start() error
- func (s *Server) StartContext(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerMux ¶
type HandlerMux interface {
Handle(pattern string, handler http.Handler)
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}
HandlerMux is the interface for registering HTTP handlers, used by RegisterOnMux so that callers can pass any mux implementation (e.g. *http.ServeMux or a custom dynamic mux).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) RegisterCheck ¶
func (*Server) RegisterOnMux ¶
func (s *Server) RegisterOnMux(mux HandlerMux)
RegisterOnMux registers /health, /ready, /reload and /shutdown handlers onto the given mux. This allows the health endpoints to be served by a shared HTTP server.
func (*Server) SetReloadFunc ¶
SetReloadFunc sets what POST /reload runs; it answers with its outcome. Its context ends when the caller is gone.
func (*Server) SetShutdownFunc ¶
func (s *Server) SetShutdownFunc(fn func())
SetShutdownFunc sets the callback POST /shutdown runs: the same graceful shutdown a SIGTERM starts. Windows has no SIGTERM to send a process, so the launcher asks through this endpoint before it resorts to killing.