Documentation
¶
Index ¶
- func GRPCServe(server GRPCServer, lis net.Listener) (execute func() error, interrupt func(error))
- func GracefulRestart(ctx context.Context, upg Upgrader) (execute func() error, interrupt func(error))
- func HTTPServe(server HTTPServer, lis net.Listener, shutdownTimeout time.Duration) (execute func() error, interrupt func(error))
- type GRPCServer
- type HTTPServer
- type ServeLogger
- type Upgrader
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCServe ¶
func GRPCServe(server GRPCServer, lis net.Listener) (execute func() error, interrupt func(error))
GRPCServe returns an actor, i.e. an execute and interrupt func, that terminates when the underlying gRPC server fails.
func GracefulRestart ¶
func GracefulRestart(ctx context.Context, upg Upgrader) (execute func() error, interrupt func(error))
GracefulRestart returns an actor, i.e. an execute and interrupt func, that terminates when graceful restart is initiated and the child process signals to be ready, or the parent context is canceled.
func HTTPServe ¶ added in v0.5.0
func HTTPServe( server HTTPServer, lis net.Listener, shutdownTimeout time.Duration, ) (execute func() error, interrupt func(error))
HTTPServe returns an actor, i.e. an execute and interrupt func, that terminates when the underlying HTTP server fails.
It accepts a timeout parameter for the graceful shutdown. 0 means no timeout.
Types ¶
type GRPCServer ¶
GRPCServer is a gRPC server.
type HTTPServer ¶ added in v0.5.0
HTTPServer is an HTTP server.
type ServeLogger ¶ added in v0.5.0
type ServeLogger interface { // Info logs an Info event. Info(msg string, fields ...map[string]interface{}) }
ServeLogger logs server start/shutdown events.
type Upgrader ¶
type Upgrader interface { Ready() error Exit() <-chan struct{} Stop() }
Upgrader handles zero downtime upgrades and passing files between processes.
Upgrader is based on https://github.com/cloudflare/tableflip.
type Wrapper ¶ added in v0.5.0
Wrapper is an actor that wraps another actor. It is useful for creating middleware.
func LogServe ¶ added in v0.5.0
func LogServe(logger ServeLogger) Wrapper
LogServe returns an actor, i.e. an execute and interrupt func, that logs a message when a server is being started/shut down.