go-vitess.v1: gopkg.in/src-d/go-vitess.v1/proc Index | Files

package proc

import "gopkg.in/src-d/go-vitess.v1/proc"

Package proc allows you to configure servers to be restarted with negligible downtime.

Index

Package Files

counting_listener.go proc.go

func Listen Uses

func Listen(port string) (l net.Listener, err error)

Listen tries to create a listener on the specified tcp port. Before creating the listener, it checks to see if there is another server already using the port. If there is one, it sends a USR1 signal requesting the server to shutdown, and then attempts to to create the listener.

func ListenAndServe Uses

func ListenAndServe(port string) os.Signal

ListenAndServe combines Listen and Wait to also run an http server on the specified port. If it fails to obtain a listener, the program is fatally terminated. The return value is the signal received for termination

func Published Uses

func Published(l net.Listener, countTag, acceptTag string) net.Listener

Published creates a wrapper for net.Listener that publishes connection stats.

func Wait Uses

func Wait() os.Signal

Wait creates an HTTP handler on pidURL, and serves the current process pid on it. It then creates a signal handler and waits for SIGTERM or SIGUSR1, and returns when the signal is received. A new server that comes up will query this URL. If it receives a valid response, it will send a SIGUSR1 signal and attempt to bind to the port the current server is using.

type CountingListener Uses

type CountingListener struct {
    net.Listener
    ConnCount  *stats.Gauge
    ConnAccept *stats.Counter
}

func (*CountingListener) Accept Uses

func (l *CountingListener) Accept() (c net.Conn, err error)

Accept increments stats counters before returning a connection.

Package proc imports 12 packages (graph) and is imported by 2 packages. Updated 2019-06-13. Refresh now. Tools for package owners.