grace

package
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvKey = `BASE_GRACEFUL`
)

Functions

This section is empty.

Types

type Graceful

type Graceful struct {
	// contains filtered or unexported fields
}

func New

func New(server Serve, envs []string) *Graceful

func NewWithHttpServer

func NewWithHttpServer(server *http.Server, envs []string) *Graceful

func (*Graceful) OnShutdown

func (g *Graceful) OnShutdown(handler Handler)

func (*Graceful) OnStart

func (g *Graceful) OnStart(handler Handler)

func (*Graceful) Serve

func (g *Graceful) Serve(addr, pprofAddr string) (err error)

func (*Graceful) ServeTLS

func (g *Graceful) ServeTLS(addr, pprofAddr string, certFile, keyFile string) (err error)

type Handler

type Handler func() error

type Serve

type Serve interface {
	Serve(ln net.Listener) error
	ServeTLS(ln net.Listener, certFile, keyFile string) error
	ShutdownWithContext(ctx context.Context) (err error)
}

type Server

type Server struct {
	*http.Server
}

func (*Server) ShutdownWithContext

func (s *Server) ShutdownWithContext(ctx context.Context) (err error)

Jump to

Keyboard shortcuts

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