Documentation ¶
Overview ¶
Package shutdown assumes the responsibility of graceful shutdown of the server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GracefulShutdown ¶
type GracefulShutdown struct {
// contains filtered or unexported fields
}
GracefulShutdown handles ShutdownCallbacks.
func (*GracefulShutdown) AddShutdownCallback ¶
func (gs *GracefulShutdown) AddShutdownCallback(callback ShutdownCallback)
AddShutdownCallback adds a ShutdownCallback that will be called when shutdown is requested.
func (*GracefulShutdown) Shutdown ¶
func (gs *GracefulShutdown) Shutdown()
Shutdown calls all calllbacks, and wait for them to finish.
func (*GracefulShutdown) Start ¶
func (gs *GracefulShutdown) Start()
Start starts listening to shutdown signals.
type ShutdownCallback ¶
ShutdownCallback is an interface you have to implement for callbacks.
type ShutdownFunc ¶
ShutdownFunc is a helper type, so you can easily provide anonymous functions as ShutdownCallbacks like this:
AddShutdownCallback(shutdown.ShutdownFunc(your_callback))
func (ShutdownFunc) OnShutdown ¶
func (f ShutdownFunc) OnShutdown(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.