umgmt

package
v0.0.0-...-d271c08 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2014 License: BSD-3-Clause Imports: 14 Imported by: 0

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

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 ListenAndServe(addr string) error

func RecvFd

func RecvFd(conn *net.UnixConn) (*os.File, error)

func SendFd

func SendFd(conn *net.UnixConn, file *os.File) error

func SetLameDuckPeriod

func SetLameDuckPeriod(f float32)

func SetRebindDelay

func SetRebindDelay(f float32)

func SigTermHandler

func SigTermHandler(signal os.Signal)

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

func StartHttpsServer(addr string, certFile, keyFile, caFile string)

StartHttpsServer binds and starts an https server.

Types

type Client

type Client struct {
	*rpc.Client
	// contains filtered or unexported fields
}

func Dial

func Dial(address string) (*Client, error)

func (*Client) Close

func (client *Client) Close() error

func (*Client) CloseListeners

func (client *Client) CloseListeners() error

func (*Client) GracefulShutdown

func (client *Client) GracefulShutdown() error

func (*Client) Ping

func (client *Client) Ping() (string, error)

type Reply

type Reply struct {
	Message string
}

type Request

type Request struct{}

type UmgmtCallback

type UmgmtCallback func()

type UmgmtListener

type UmgmtListener interface {
	Close() error
	Addr() net.Addr
}

type UmgmtServer

type UmgmtServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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)

func (*UmgmtService) Ping

func (service *UmgmtService) Ping(request *Request, reply *Reply) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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