runtime

package
v0.0.0-...-7412f86 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvInt

func EnvInt(key string, def int) int

func EnvString

func EnvString(key, def string) string

func HandleSignals

func HandleSignals(shutdownc <-chan io.Closer)

func MinimalContainer

func MinimalContainer(port int, endpoint func() http.Handler, shutdown func() error)

func NewManagerEndPoint

func NewManagerEndPoint(config Config) http.Handler

func RunServer

func RunServer(server *http.Server, stop chan bool) (stopped chan bool)

Runs the http server. This server offers more control than the standard go's default http server in that when a 'true' is sent to the stop channel, the listener is closed to force a clean shutdown.

func RunUpdate

func RunUpdate(request *UpdateExecutableRequest) <-chan UpdateResult

func SavePidFile

func SavePidFile(args ...string) (string, error)

func ShutdownHook

func ShutdownHook(h func() error) closeWrapper

func StandardContainer

func StandardContainer(port int, endpoint func() http.Handler, shutdown func() error)

func StartUpdateHandler

func StartUpdateHandler(resp http.ResponseWriter, request *http.Request)

Types

type BuildInfoProvider

type BuildInfoProvider interface {
	GetCommitHash() string
	GetBuildTimestamp() string
	GetBuildNumber() string
}

type Config

type Config struct {
	BuildInfo BuildInfoProvider
}

func (*Config) InfoHandler

func (config *Config) InfoHandler(resp http.ResponseWriter, request *http.Request)

type Info

type Info struct {
	Uptime         float64 `json:"uptime_seconds"`
	Commit         string  `json:"git_commit"`
	BuildTimestamp string  `json:"build_timestamp"`
	BuildNumber    string  `json:"build"`
}

type ShutdownSequence

type ShutdownSequence []io.Closer

func (ShutdownSequence) Close

func (s ShutdownSequence) Close() (err error)

Implements io.Closer

type UpdateExecutableRequest

type UpdateExecutableRequest struct {
	DownloadUrl string `json:"downloadUrl"`
}

type UpdateResult

type UpdateResult struct {
	Error        error
	RecoverError error
}

Jump to

Keyboard shortcuts

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