Documentation
¶
Overview ¶
Package zerodt offers a zero downtime restart and a graceful shutdown for HTTP servers.
The simplest way to use ZeroDT is to pass your http.Server to the NewApp() function and call ListenAndServe() for an object it returns:
package main
import (
"io"
"net/http"
"time"
"github.com/acronis/zerodt"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello world!")
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", hello)
a := zerodt.NewApp(&http.Server{Addr: ":8081", Handler: mux})
a.ListenAndServe()
}
For more details visit https://github.com/acronis/zerodt
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
PreServeFn func(inherited bool) error
CompleteShutdownFn func()
PreParentExitFn func()
// contains filtered or unexported fields
}
App specifies functions to control passed HTTP servers.
func (*App) ListenAndServe ¶ added in v0.1.1
ListenAndServe calls ListenAndServe for all servers and returns first error if happens or nil.
func (*App) SetWaitChildTimeout ¶ added in v0.1.1
SetWaitChildTimeout does nothing.
func (*App) SetWaitParentShutdownTimeout ¶ added in v0.1.1
SetWaitParentShutdownTimeout does nothing.