life

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package life helps manage life states for k8 applications. It exposes ready contexts and a handler for handling ready probes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliveOrDead

func AliveOrDead() (context.Context, context.CancelFunc, bool)

AliveOrDead returns the alive context.

func NewHandler

func NewHandler(next http.Handler) http.Handler

NewHandler returns a new http.Handler that response to probe message to GET /ready

func Ready

func Ready() (result context.Context, resultCancel context.CancelFunc)

Ready blocks until SetReady is called with a valid context, then it returns the ready context.

func ReadyOrNot

func ReadyOrNot() (context.Context, context.CancelFunc, bool)

ReadyOrNot is like Ready() except that it doesn't block. It returns true if ready, otherwise false.

func SetReady

func SetReady(parent context.Context) (err error)

SetReady sets a ready context that was derived from parent. SetReady will return an error if already ready. If parent is nil, the ready context will be derived from the alive context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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