Documentation ¶
Overview ¶
Package umgmt (micromanagment) provides a tiny server running on a unix domain socket.
It is meant as an alternative to signals for handling graceful server management. The decision to use unix domain sockets was motivated by future intend to implement file descriptor passing.
The underlying unix socket acts as a guard for starting up a server. Once that socket has be acquired it is assumed that previously bound sockets will be released and startup can continue. You must delegate execution of your server initialization to this module via AddStartupCallback().
Index ¶
- func AddCloseCallback(f UmgmtCallback)
- func AddListener(listener UmgmtListener)
- func AddShutdownCallback(f UmgmtCallback)
- func AddStartupCallback(f UmgmtCallback)
- func ListenAndServe(addr string) error
- func RecvFd(conn *net.UnixConn) (*os.File, error)
- func SendFd(conn *net.UnixConn, file *os.File) error
- func SetLameDuckPeriod(f float32)
- func SetRebindDelay(f float32)
- func SigTermHandler(signal os.Signal)
- func StartHttpServer(addr string)
- func StartHttpsServer(addr string, certFile, keyFile, caFile string)
- type Client
- type Reply
- type Request
- type UmgmtCallback
- type UmgmtListener
- type UmgmtServer
- type UmgmtService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCloseCallback ¶
func AddCloseCallback(f UmgmtCallback)
func AddListener ¶
func AddListener(listener UmgmtListener)
func AddShutdownCallback ¶
func AddShutdownCallback(f UmgmtCallback)
func AddStartupCallback ¶
func AddStartupCallback(f UmgmtCallback)
func ListenAndServe ¶
func SetLameDuckPeriod ¶
func SetLameDuckPeriod(f float32)
func SetRebindDelay ¶
func SetRebindDelay(f float32)
func SigTermHandler ¶
func StartHttpServer ¶
func StartHttpServer(addr string)
StartHttpServer binds and starts an http server. usually it is called like:
umgmt.AddStartupCallback(func () { umgmt.StartHttpServer(addr) })
func StartHttpsServer ¶
StartHttpsServer binds and starts an https server.
Types ¶
type UmgmtCallback ¶
type UmgmtCallback func()
type UmgmtListener ¶
type UmgmtServer ¶
func (*UmgmtServer) Addr ¶
func (server *UmgmtServer) Addr() net.Addr
func (*UmgmtServer) Close ¶
func (server *UmgmtServer) Close() error
func (*UmgmtServer) Serve ¶
func (server *UmgmtServer) Serve() error
NOTE(msolomon) This function handles requests serially. Multiple clients to umgmt doesn't make sense.
type UmgmtService ¶
type UmgmtService struct {
// contains filtered or unexported fields
}
func (*UmgmtService) CloseListeners ¶
func (service *UmgmtService) CloseListeners(request *Request, reply *Reply) (err error)
func (*UmgmtService) GracefulShutdown ¶
func (service *UmgmtService) GracefulShutdown(request *Request, reply *Reply) (err error)