Documentation
¶
Overview ¶
Package upgrade implements zero-downtime restarts by handing the listening sockets to a freshly-exec'd copy of the binary. The child inherits the bound listener file descriptors and starts accepting on them immediately, so the data-plane ports never close; the parent then drains its existing connections and exits.
Listeners participate by creating their sockets through ListenTCP / ListenUDP instead of binding directly: on a normal start these bind fresh and register the socket for later handoff; after an upgrade they transparently adopt the inherited socket matching their address.
Socket inheritance relies on passing file descriptors to a child process, which is only available on Unix-like systems. On other platforms an upgrade request returns an error and ListenTCP / ListenUDP simply bind fresh.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenTCP ¶
ListenTCP returns a TCP listener for addr, adopting an inherited socket if one was passed by a parent process during an upgrade, otherwise binding fresh. The returned listener is registered for a future handoff.
func ListenUDP ¶
ListenUDP returns a UDP packet connection for addr, adopting an inherited socket if available, otherwise binding fresh, and registers it for handoff.
Types ¶
This section is empty.